com.continuent.tungsten.replicator.database
Class Key

java.lang.Object
  extended by com.continuent.tungsten.replicator.database.Key

public class Key
extends java.lang.Object

This class defines a Key

Version:
1.0
Author:
Scott Martin

Field Summary
static int IllegalType
           
static int NonUnique
           
static int Primary
           
static int Unique
           
 
Constructor Summary
Key()
          Creates a new key with no information.
Key(int type)
          Creates a new key including the type.
 
Method Summary
 void AddColumn(Column column)
          Adds a column to the key definition.
 java.util.ArrayList<Column> getColumns()
          Returns the columns in this key.
 long getMaxCardinality()
          Returns the maximum cardinality of index columns or 0 if cardinality is unknown.
 java.lang.String getName()
          Returns the index name corresponding to this key.
 int getType()
          Returns the key type.
 boolean isPrimaryKey()
          Returns true if this is a primary key.
 boolean isSecondaryKey()
          Returns true if this is a secondary (i.e., non-primary) key.
 boolean isUnique()
          Returns true if key is unique, i.e., has one and only one value per entry.
 void setMaxCardinality(long maxCardinality)
          Sets the maximum index cardinality.
 void setName(java.lang.String name)
          Sets the index name corresponding to this key.
 void setType(int type)
          Sets the key type.
 int size()
          Returns the number of columns in the key.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

IllegalType

public static final int IllegalType
See Also:
Constant Field Values

NonUnique

public static final int NonUnique
See Also:
Constant Field Values

Primary

public static final int Primary
See Also:
Constant Field Values

Unique

public static final int Unique
See Also:
Constant Field Values
Constructor Detail

Key

public Key()
Creates a new key with no information.


Key

public Key(int type)
Creates a new key including the type.

Method Detail

getType

public int getType()
Returns the key type.


setType

public void setType(int type)
Sets the key type.


getName

public java.lang.String getName()
Returns the index name corresponding to this key.


setName

public void setName(java.lang.String name)
Sets the index name corresponding to this key.


AddColumn

public void AddColumn(Column column)
Adds a column to the key definition.


getColumns

public java.util.ArrayList<Column> getColumns()
Returns the columns in this key.


getMaxCardinality

public long getMaxCardinality()
Returns the maximum cardinality of index columns or 0 if cardinality is unknown. Cardinality is used in making decisions about index specificity.


setMaxCardinality

public void setMaxCardinality(long maxCardinality)
Sets the maximum index cardinality.


isUnique

public boolean isUnique()
Returns true if key is unique, i.e., has one and only one value per entry.


isPrimaryKey

public boolean isPrimaryKey()
Returns true if this is a primary key.


isSecondaryKey

public boolean isSecondaryKey()
Returns true if this is a secondary (i.e., non-primary) key.


size

public int size()
Returns the number of columns in the key.


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()