jmarkov.basic
Class ActionsSet<A extends Action>

java.lang.Object
  extended by jmarkov.basic.ActionsSet<A>
Type Parameters:
A - The action class.
All Implemented Interfaces:
java.lang.Iterable<A>, Actions<A>

public class ActionsSet<A extends Action>
extends java.lang.Object
implements Actions<A>

This class represents a set of objects Action. It uses the TreeSet structure to avoid repeated actions. This class extends the Actions class.

Author:
Andres Sarmiento, Germán Riaño - Universidad de Los Andes
See Also:
Collection, Actions, Action

Constructor Summary
ActionsSet()
          Creates an empty set of Actions.
ActionsSet(A ac)
          Creates a set of Actions from a given Action.
ActionsSet(A[] acArray)
          Creates a set of Actions from a given array of Actions.
ActionsSet(Actions<A> ac)
          Creates a set of Actions from a given set of Actions.
ActionsSet(java.lang.Iterable<A> actIter)
          Creates a set of actions from any iterable object over actions.
 
Method Summary
 void add(A a)
          This method adds a new action to the set.
 java.util.Iterator<A> iterator()
          This method returns a safe way to walk along the actions in a particular set.
 int size()
          Returns the number of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionsSet

public ActionsSet(Actions<A> ac)
Creates a set of Actions from a given set of Actions.

Parameters:
ac - set of Actions of type Actions.

ActionsSet

public ActionsSet(java.lang.Iterable<A> actIter)
Creates a set of actions from any iterable object over actions.

Parameters:
actIter -

ActionsSet

public ActionsSet(A[] acArray)
Creates a set of Actions from a given array of Actions. This constructor organizes the actions in a TreeSet.

Parameters:
acArray - set of Actions of type Actions.

ActionsSet

public ActionsSet(A ac)
Creates a set of Actions from a given Action. This constructor organizes the actions in a TreeSet.

Parameters:
ac - an Action.

ActionsSet

public ActionsSet()
Creates an empty set of Actions.

Method Detail

add

public void add(A a)
This method adds a new action to the set.

Parameters:
a - The action to be added.

iterator

public final java.util.Iterator<A> iterator()
This method returns a safe way to walk along the actions in a particular set. Collections and their implementations (Set, List, and Map) have iterators defined by default.

Specified by:
iterator in interface java.lang.Iterable<A extends Action>
Specified by:
iterator in interface Actions<A extends Action>
Returns:
iterator over the states.

size

public int size()
Description copied from interface: Actions
Returns the number of elements.

Specified by:
size in interface Actions<A extends Action>
Returns:
the amount of actions in the set.