net.jinx.action.input
Class Condition

java.lang.Object
  extended by net.jinx.action.input.Condition

public class Condition
extends java.lang.Object

This is used by Participants to communicate the current situation to their Behaviors. This can also be used by Behaviors to store variables related to their decision making process.

API Stability: Alpha.


Constructor Summary
Condition()
          Constructs a new, blank Condition.
 
Method Summary
 java.lang.Object clone()
          Copies this Condition.
 java.lang.Object get(java.lang.String key)
          Returns the value associated with key.
 boolean hasKey(java.lang.String key)
          Determines if the given key has a value associated with it.
 boolean hasValue(java.lang.Object value)
          Determines if the given value has a key associated with it.
 boolean isEmpty()
          Determines if there are no key-value pairs.
 java.util.Iterator keyIterator()
          Provides an Iterator for the keys.
 java.lang.Object remove(java.lang.String key)
          Removes the key-value pairing for the given key.
 java.lang.Object set(java.lang.String key, java.lang.Object value)
          Sets the given key equal to value.
 void setAll(Condition c)
          Duplicates all of the key-value pairs in c into this Condition.
 int size()
          Returns the number of key-value pairs currently set.
 java.util.Iterator valueIterator()
          Provides an Iterator for the values.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Condition

public Condition()
Constructs a new, blank Condition.

Method Detail

set

public java.lang.Object set(java.lang.String key,
                            java.lang.Object value)
Sets the given key equal to value.

Parameters:
key - the String key to set.
value - the value to associate with key.
Returns:
the previous value associated with key.
Throws:
java.lang.NullPointerException - if either key or value are null.

get

public java.lang.Object get(java.lang.String key)
Returns the value associated with key.

Parameters:
key - the String key.
Returns:
the value.

remove

public java.lang.Object remove(java.lang.String key)
Removes the key-value pairing for the given key.

Parameters:
key - the String key.
Returns:
the previous value associated with key.

size

public int size()
Returns the number of key-value pairs currently set.

Returns:
the number.

hasKey

public boolean hasKey(java.lang.String key)
Determines if the given key has a value associated with it.

Parameters:
key - the String key.
Returns:
true if key has a value.

hasValue

public boolean hasValue(java.lang.Object value)
Determines if the given value has a key associated with it.

Parameters:
value - the value.
Returns:
true if value has a key.

keyIterator

public java.util.Iterator keyIterator()
Provides an Iterator for the keys.

Returns:
the Iterator.

valueIterator

public java.util.Iterator valueIterator()
Provides an Iterator for the values.

Returns:
the Iterator.

clone

public java.lang.Object clone()
Copies this Condition.

Overrides:
clone in class java.lang.Object
Returns:
the new Condition.

isEmpty

public boolean isEmpty()
Determines if there are no key-value pairs.

Returns:
true if there are no mappings.

setAll

public void setAll(Condition c)
Duplicates all of the key-value pairs in c into this Condition. Any keys already set are replaced.

Parameters:
c - the Condition object to duplicate key-value pairs from.