All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tenio.common.data.zero.ZeroMap Maven / Gradle / Ivy

Go to download

TenIO is a java NIO (Non-blocking I/O) based server specifically designed for multiplayer games. It supports UDP and TCP transports which are handled by Netty for high-speed network transmission. This is the common module for multipurpose use of the framework.

There is a newer version: 0.6.0
Show newest version
/*
The MIT License

Copyright (c) 2016-2022 kong 

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

package com.tenio.common.data.zero;

import java.util.Collection;
import java.util.Map;

/**
 * This class holds data by pairs of key and value, works like a map.
 */
public interface ZeroMap extends ReadonlyZeroMap, Iterable> {

  /**
   * Removes an element by using its key.
   *
   * @param key the {@link String} key of element should be removed
   * @return true if the action is successful, otherwise false
   */
  boolean removeElement(String key);

  /**
   * Puts a null value into the map.
   *
   * @param key the {@link String} key of element
   * @return the pointer of this instance
   */
  ZeroMap putNull(String key);

  /**
   * Puts a boolean value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putBoolean(String key, boolean data);

  /**
   * Puts a byte value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putByte(String key, byte data);

  /**
   * Puts a short value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putShort(String key, short data);

  /**
   * Puts a integer value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putInteger(String key, int data);

  /**
   * Puts a long value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putLong(String key, long data);

  /**
   * Puts a float value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putFloat(String key, float data);

  /**
   * Puts a double value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putDouble(String key, double data);

  /**
   * Puts a {@link String} value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putString(String key, String data);

  /**
   * Puts a {@link ZeroArray} value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putZeroArray(String key, ZeroArray data);

  /**
   * Puts a {@link ZeroMap} value into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putZeroMap(String key, ZeroMap data);

  /**
   * Puts a {@link ZeroElement} into the map.
   *
   * @param key     the {@link String} key of element
   * @param element the inserted data
   * @return the pointer of this instance
   */
  ZeroMap putZeroElement(String key, ZeroElement element);

  /**
   * Puts a collection of {@link Boolean} values into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putBooleanArray(String key, Collection data);

  /**
   * Puts an array of binaries into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted byte[] data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putByteArray(String key, byte[] data);

  /**
   * Puts a collection of {@link Short} values into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putShortArray(String key, Collection data);

  /**
   * Puts a collection of {@link Integer} values into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putIntegerArray(String key, Collection data);

  /**
   * Puts a collection of {@link Long} values into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putLongArray(String key, Collection data);

  /**
   * Puts a collection of {@link Float} values into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putFloatArray(String key, Collection data);

  /**
   * Puts a collection of {@link Double} values into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putDoubleArray(String key, Collection data);

  /**
   * Puts a collection of {@link String} values into the map.
   *
   * @param key  the {@link String} key of element
   * @param data the inserted data
   * @return the pointer of this instance
   * @see Collection
   */
  ZeroMap putStringArray(String key, Collection data);

  /**
   * Retrieves a new map in read-only mode.
   *
   * @return a read-only map {@link ReadonlyZeroMap}
   */
  ReadonlyZeroMap getReadonlyZeroMap();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy