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

jasima.core.util.ValueStore Maven / Gradle / Ivy

/*******************************************************************************
 * This file is part of jasima, v1.3, the Java simulator for manufacturing and 
 * logistics.
 *  
 * Copyright (c) 2015 		jasima solutions UG
 * Copyright (c) 2010-2015 Torsten Hildebrandt and jasima contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 *******************************************************************************/
package jasima.core.util;

import java.util.HashMap;
import java.util.Set;

/**
 * This interface provides a simple get/put-mechanism to store a value
 * associated with a key object, similar to a @link {@link HashMap}.
 * 
 * @author Torsten Hildebrandt
 * @version 
 *          "$Id: ValueStore.java 753 2015-07-27 15:29:49Z [email protected] $"
 */
public interface ValueStore {

	/**
	 * Puts a value in the value store, potentially overwriting an existing
	 * value associated with the same key.
	 * 
	 * @param key
	 *            The key name.
	 * @param value
	 *            value to assign to {@code key}.
	 * @see #valueStoreGet(Object)
	 */
	public void valueStorePut(Object key, Object value);

	/**
	 * Retrieves a value from the value store.
	 * 
	 * @param key
	 *            The entry to return, e.g., identified by a name.
	 * @return The value associated with {@code key}.
	 * 
	 * @see #valueStorePut(Object, Object)
	 */
	public Object valueStoreGet(Object key);

	/**
	 * Returns the number of keys in this value store.
	 */
	public int valueStoreGetNumKeys();

	/**
	 * Returns a list of all keys contained in this value store.
	 */
	public Set valueStoreGetAllKeys();

	/**
	 * Removes an entry from this value store.
	 * 
	 * @return The value previously associated with "key", or null, if no such
	 *         key was found.
	 */
	public Object valueStoreRemove(Object key);

}