net.sourceforge.cilib.type.types
Class Blackboard<K,V extends Type>

java.lang.Object
  extended by net.sourceforge.cilib.type.types.Blackboard<K,V>
Type Parameters:
K - The key type.
V - The value type.
All Implemented Interfaces:
Serializable, Type, Cloneable

public class Blackboard<K,V extends Type>
extends Object
implements Type

Simple Blackboard implementation.

See Also:
Serialized Form

Constructor Summary
Blackboard()
          Create a new empty Blackboard container.
Blackboard(Blackboard<K,V> copy)
          Copy constructor.
 
Method Summary
 Set<Map.Entry<K,V>> entrySet()
          Obtain a Set of key / value pairs.
 boolean equals(Object obj)
          Compare the specified object with this type for equality.
 V get(K key)
          Get the value associated with the provided key, null otherwise.
 Blackboard<K,V> getClone()
          Create a cloned copy of the current object and return it.
 int hashCode()
          Returns the hash code value for this list.
 V put(K key, V value)
          Put the provided key / value pair into the Blackboard.
 void reset()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Blackboard

public Blackboard()
Create a new empty Blackboard container.


Blackboard

public Blackboard(Blackboard<K,V> copy)
Copy constructor. Create a copy of the provided instance.

Parameters:
copy - The isntance to copy.
Method Detail

getClone

public Blackboard<K,V> getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Type
Specified by:
getClone in interface Cloneable
Returns:
See Also:
Object.clone()

equals

public boolean equals(Object obj)
Compare the specified object with this type for equality. Returns true if and only if the specified object is also an instance of the same type.

Specified by:
equals in interface Type
Overrides:
equals in class Object
Parameters:
obj - The object to compare.
Returns:
true if equality exists, false otherwise.
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:
  int hashCode = 7;
  Iterator<E> i = list.iterator();
  while (i.hasNext()) {
      E obj = i.next();
      hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
  }
 
This ensures that type1.equals(type2) implies that type1.hashCode()==type2.hashCode() for any two types, type1 and type2, as required by the general contract of Object.hashCode().

Specified by:
hashCode in interface Type
Overrides:
hashCode in class Object
Returns:
the hash code value for this list
See Also:
Object.equals(Object), Type.equals(Object)

reset

public void reset()


toString

public String toString()

Overrides:
toString in class Object

put

public V put(K key,
             V value)
Put the provided key / value pair into the Blackboard.

Parameters:
key - The key value for the pair.
value - The value associated with the key.
Returns:
The provided value.

get

public V get(K key)
Get the value associated with the provided key, null otherwise.

Parameters:
key - The key to obtained the value of.
Returns:
The associated value to the key.

entrySet

public Set<Map.Entry<K,V>> entrySet()
Obtain a Set of key / value pairs.

Returns:
The set of values.


Copyright © 2009 CIRG. All Rights Reserved.