dk.brics.grammar.operations
Class AutomataCollection

java.lang.Object
  extended by dk.brics.grammar.operations.AutomataCollection
All Implemented Interfaces:
Iterable<Automaton>

public class AutomataCollection
extends Object
implements Iterable<Automaton>

Representation of a collection of automata. Singleton automata with equal strings are treated as equal, other automata are compared by object identity. (In other words, automata that are equal but not identical may be represented multiple times.)


Field Summary
static AutomataCollection emptyAutomataCollection
          Empty AutomataCollection (immutable).
 
Constructor Summary
AutomataCollection()
          Constructs a new empty automata collection.
AutomataCollection(AutomataCollection ac)
          Constructs a new automata collection as a (shallow) copy of an existing one.
 
Method Summary
 boolean add(Automaton a)
          Adds an automaton.
 boolean addAll(AutomataCollection as)
          Adds a collection of automata.
 Collection<Automaton> getCollection()
          Returns the collection as a Collection<Automaton>.
 Iterator<Automaton> iterator()
          Returns iterator.
 void makeImmutable()
          Makes this collection immutable.
 boolean retainAll(AutomataCollection as)
          Retains only the automata in this collection that are contained in the specified collection.
 String toString()
          Returns a string describing this automata collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

emptyAutomataCollection

public static AutomataCollection emptyAutomataCollection
Empty AutomataCollection (immutable).

Constructor Detail

AutomataCollection

public AutomataCollection()
Constructs a new empty automata collection.


AutomataCollection

public AutomataCollection(AutomataCollection ac)
Constructs a new automata collection as a (shallow) copy of an existing one.

Method Detail

add

public boolean add(Automaton a)
Adds an automaton.

Parameters:
a - automaton to add
Returns:
true if this collection changed

addAll

public boolean addAll(AutomataCollection as)
Adds a collection of automata.

Parameters:
as - automata to add
Returns:
true if this collection changed

getCollection

public Collection<Automaton> getCollection()
Returns the collection as a Collection<Automaton>.


iterator

public Iterator<Automaton> iterator()
Returns iterator.

Specified by:
iterator in interface Iterable<Automaton>
Returns:
iterator

makeImmutable

public void makeImmutable()
Makes this collection immutable. Subsequent attempts to add automata result in UnsupportedOperationException.


retainAll

public boolean retainAll(AutomataCollection as)
Retains only the automata in this collection that are contained in the specified collection.

Parameters:
as - automata to be retained (non-null)
Returns:
true if this collection changed

toString

public String toString()
Returns a string describing this automata collection.

Overrides:
toString in class Object


Copyright © 2005-2008 Anders Møller.