com.jgpruitt.datamodeler.core
Class UniqueKeySet

java.lang.Object
  extended by com.jgpruitt.datamodeler.core.UniqueKeySet
All Implemented Interfaces:
java.lang.Iterable<UniqueKey>

public class UniqueKeySet
extends java.lang.Object
implements java.lang.Iterable<UniqueKey>

A collection of UniqueKeys on a Table

Author:
John Pruitt
See Also:
UniqueKey, Table

Field Summary
protected  java.util.List<UniqueKey> list
           
protected  java.util.Map<java.lang.String,UniqueKey> map
           
protected  Table table
           
 
Constructor Summary
UniqueKeySet(Table table)
          Constructor
 
Method Summary
 UniqueKey add(UniqueKey uk)
          Adds a UniqueKey to the set
 boolean contains(java.lang.String name)
          Tests whether the set contains a UniqueKey by the given name
 boolean contains(UniqueKey uk)
          Tests whether the set contains a UniqueKey
 UniqueKey get(int index)
          Gets a UniqueKey from the set by index
 UniqueKey get(java.lang.String name)
          Gets a UniqueKey from the set by name
 Table getTable()
          Gets the Table being constrained
 boolean isEmpty()
          Returns true if the set has no UniqueKeys in it
 java.util.Iterator<UniqueKey> iterator()
          Gets a read-only iterator over the UniqueKeys in the set
 int size()
          Gets the number of UniqueKeys in the set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

protected final Table table

map

protected final java.util.Map<java.lang.String,UniqueKey> map

list

protected final java.util.List<UniqueKey> list
Constructor Detail

UniqueKeySet

public UniqueKeySet(Table table)
Constructor

Parameters:
table - the Table being constrained by the UniqueKey
Method Detail

getTable

public Table getTable()
Gets the Table being constrained

Returns:
the Table

add

public UniqueKey add(UniqueKey uk)
Adds a UniqueKey to the set

Parameters:
uk - the UniqueKey
Returns:
the UniqueKey that was added

get

public UniqueKey get(int index)
Gets a UniqueKey from the set by index

Parameters:
index - the index
Returns:
the UniqueKey

get

public UniqueKey get(java.lang.String name)
Gets a UniqueKey from the set by name

Parameters:
name - the name of the UniqueKey
Returns:
the UniqueKey

contains

public boolean contains(java.lang.String name)
Tests whether the set contains a UniqueKey by the given name

Parameters:
name - the name of the UniqueKey
Returns:
true if the set contains a UniqueKey by the name

contains

public boolean contains(UniqueKey uk)
Tests whether the set contains a UniqueKey

Parameters:
uk - the UniqueKey
Returns:
true if the UniqueKey is in the set

iterator

public java.util.Iterator<UniqueKey> iterator()
Gets a read-only iterator over the UniqueKeys in the set

Specified by:
iterator in interface java.lang.Iterable<UniqueKey>
Returns:
the Iterator

isEmpty

public boolean isEmpty()
Returns true if the set has no UniqueKeys in it

Returns:
true if empty

size

public int size()
Gets the number of UniqueKeys in the set

Returns:
the number of UniqueKeys in the set