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

com.tenio.common.data.zero.ReadonlyZeroMap 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 com.tenio.common.data.DataCollection;
import java.util.Collection;
import java.util.Set;

/**
 * This class holds data by pairs of key and value, works like a map in read-only mode.
 */
public interface ReadonlyZeroMap extends DataCollection {

  /**
   * Determines whether a value in the map is {@link ZeroType#NULL} type.
   *
   * @param key the {@link String} key used to fetch value
   * @return true if an element is available, and it equals to
   * {@link ZeroType#NULL} type, otherwise false
   * @see ZeroType
   */
  boolean isNull(String key);

  /**
   * Determines whether a value is available in map.
   *
   * @param key the {@link String} key for checking
   * @return true if the key is found, otherwise false
   */
  boolean containsKey(String key);

  /**
   * Retrieves a set of keys in map.
   *
   * @return a {@link Set} of keys in map.
   */
  Set getKeys();

  /**
   * Retrieves an unmodifiable set of keys in map.
   *
   * @return an unmodifiable {@link Set} of keys in map.
   */
  Set getReadonlyKeys();

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link Boolean} type
   */
  Boolean getBoolean(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link Byte} type
   */
  Byte getByte(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link Short} type
   */
  Short getShort(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String}  key needs to be checked
   * @return the value held fetched by its key in {@link Integer} type
   */
  Integer getInteger(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link Long} type
   */
  Long getLong(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link Float} type
   */
  Float getFloat(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link Double} type
   */
  Double getDouble(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link String} type
   */
  String getString(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link ZeroArray} type
   */
  ZeroArray getZeroArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link ZeroMap} type
   */
  ZeroMap getZeroMap(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held fetched by its key in {@link ZeroElement} type
   */
  ZeroElement getZeroElement(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the key in the map of {@link Boolean} type
   * @see Collection
   */
  Collection getBooleanArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the key in a map of an array of binaries
   */
  byte[] getByteArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the index in a collection of {@link Short} type
   * @see Collection
   */
  Collection getShortArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the key in  the map of {@link Integer} type
   * @see Collection
   */
  Collection getIntegerArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the key in the map of {@link Long} type
   * @see Collection
   */
  Collection getLongArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the key in the map of {@link Float} type
   * @see Collection
   */
  Collection getFloatArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the key in the map of {@link Double} type
   * @see Collection
   */
  Collection getDoubleArray(String key);

  /**
   * Retrieves the data of element by its key in the map.
   *
   * @param key the {@link String} key needs to be checked
   * @return the value held at the key in the map of {@link String} type
   * @see Collection
   */
  Collection getStringArray(String key);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy