com.jgpruitt.datamodeler.core
Class Index

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

public class Index
extends java.lang.Object
implements java.lang.Iterable<SortedColumn>

This class models a database index.

Author:
John Pruitt

Field Summary
protected  java.lang.String comment
           
protected  java.util.List<SortedColumn> list
           
protected  java.util.Map<java.lang.String,SortedColumn> map
           
protected  java.lang.String name
           
protected  Table table
           
 
Constructor Summary
Index(java.lang.String name)
          Constructor.
 
Method Summary
 SortedColumn add(SortedColumn col)
          Adds a SortedColumn to the Index
 boolean contains(SortedColumn col)
          Tests whether the given SortedColumn is in the set
 boolean contains(java.lang.String name)
          Tests to see if the Index contains a SortedColumn with the given name
 SortedColumn get(int index)
          Gets the SortedColumn at the given index
 SortedColumn get(java.lang.String name)
          Gets the SortedColumn by name
 java.lang.String getComment()
          Gets the comment associated with this Index
 java.lang.String getName()
          Gets the name of the Index.
 Table getTable()
          Gets the Table being indexed by this Index
 boolean isEmpty()
          Returns true if the Index has no SortedColumns
 java.util.Iterator<SortedColumn> iterator()
          Gets an Iterator over the SortedColumns in the Index
 void setComment(java.lang.String comment)
          Sets the comment associated with this Index
 void setTable(Table table)
          Sets the Table being indexed by this Index
 int size()
          Gets the number of SortedColumns in the Index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

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

list

protected final java.util.List<SortedColumn> list

name

protected final java.lang.String name

table

protected Table table

comment

protected java.lang.String comment
Constructor Detail

Index

public Index(java.lang.String name)
Constructor.

Parameters:
name - The name of the Index
Method Detail

getName

public java.lang.String getName()
Gets the name of the Index.

Returns:
the name of the Index

getTable

public Table getTable()
Gets the Table being indexed by this Index

Returns:
the Table

setTable

public void setTable(Table table)
Sets the Table being indexed by this Index

Parameters:
table - the Table

add

public SortedColumn add(SortedColumn col)
Adds a SortedColumn to the Index

Parameters:
col - the SortedColumn to add
Returns:
the SortedColumn that was added
See Also:
SortedColumn

get

public SortedColumn get(int index)
Gets the SortedColumn at the given index

Parameters:
index - the index of the SortedColumn to get
Returns:
the SortedColumn
See Also:
SortedColumn

get

public SortedColumn get(java.lang.String name)
Gets the SortedColumn by name

Parameters:
name - The name of the SortedColumn to get
Returns:
The SortedColumn
See Also:
SortedColumn

contains

public boolean contains(java.lang.String name)
Tests to see if the Index contains a SortedColumn with the given name

Parameters:
name - the name of the SortedColumn to test for
Returns:
true if the Index contains a SortedColumn by the name given

contains

public boolean contains(SortedColumn col)
Tests whether the given SortedColumn is in the set

Parameters:
col - the SortedColumn
Returns:
true if the SortedColumn is in the set

iterator

public java.util.Iterator<SortedColumn> iterator()
Gets an Iterator over the SortedColumns in the Index

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

isEmpty

public boolean isEmpty()
Returns true if the Index has no SortedColumns

Returns:
true if the Index is empty

size

public int size()
Gets the number of SortedColumns in the Index

Returns:
the number of SortedColumns in the Index

getComment

public java.lang.String getComment()
Gets the comment associated with this Index

Returns:
the comment.

setComment

public void setComment(java.lang.String comment)
Sets the comment associated with this Index

Parameters:
comment - the comment.