Package edu.caltech.nanodb.relations
Class ColumnRefs
- java.lang.Object
-
- edu.caltech.nanodb.relations.ColumnRefs
-
- Direct Known Subclasses:
IndexColumnRefs
,KeyColumnRefs
public class ColumnRefs extends java.lang.Object
This class represents a set of columns in a schema by specifying the indexes of the columns in the set. This is used to represent primary keys, candidate keys, foreign keys, and columns in indexes. Because it can represent constraints, an optional constraint-name and constraint-type can be specified on the class.
-
-
Field Summary
Fields Modifier and Type Field Description private int[]
colIndexes
This array holds the indexes of the columns in the set.private java.lang.String
constraintName
This is the optional name of the constraint specified in the DDL.private TableConstraintType
constraintType
This optional field can indicate if there is a particular constraint on the indicated set of columns.
-
Constructor Summary
Constructors Modifier Constructor Description ColumnRefs(int[] colIndexes)
protected
ColumnRefs(int[] colIndexes, java.lang.String constraintName, TableConstraintType constraintType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equalsColumns(int[] indexes)
Returns true if the specified array of column-indexes has the same columns as this object, in the exact same order.boolean
equalsColumns(ColumnRefs ci)
Returns true if the specified ColumnIndexes object has the same columns as this object, in the exact same order.int
getCol(int i)
int[]
getCols()
java.lang.String
getConstraintName()
TableConstraintType
getConstraintType()
boolean
hasSameColumns(int[] indexes)
Returns true if the specified array of column-indexes has the same columns as this object, independent of order.boolean
hasSameColumns(ColumnRefs ci)
Returns true if the specified ColumnIndexes object has the same columns as this object, independent of order.void
setConstraintName(java.lang.String constraintName)
void
setConstraintType(TableConstraintType constraintType)
int
size()
java.lang.String
toString()
-
-
-
Field Detail
-
colIndexes
private int[] colIndexes
This array holds the indexes of the columns in the set.
-
constraintName
private java.lang.String constraintName
This is the optional name of the constraint specified in the DDL.
-
constraintType
private TableConstraintType constraintType
This optional field can indicate if there is a particular constraint on the indicated set of columns.
-
-
Constructor Detail
-
ColumnRefs
protected ColumnRefs(int[] colIndexes, java.lang.String constraintName, TableConstraintType constraintType)
-
ColumnRefs
public ColumnRefs(int[] colIndexes)
-
-
Method Detail
-
size
public int size()
-
getCol
public int getCol(int i)
-
getCols
public int[] getCols()
-
equalsColumns
public boolean equalsColumns(ColumnRefs ci)
Returns true if the specified ColumnIndexes object has the same columns as this object, in the exact same order.- Parameters:
ci
- the ColumnIndexes object to compare to this object- Returns:
- true if the two objects have the same column indexes, in the exact same order
-
equalsColumns
public boolean equalsColumns(int[] indexes)
Returns true if the specified array of column-indexes has the same columns as this object, in the exact same order.- Parameters:
indexes
- the array of indexes to compare to this object- Returns:
- true if the two objects have the same column indexes, in the exact same order
-
hasSameColumns
public boolean hasSameColumns(ColumnRefs ci)
Returns true if the specified ColumnIndexes object has the same columns as this object, independent of order.- Parameters:
ci
- the ColumnIndexes object to compare to this object- Returns:
- true if the two objects have the same column indexes, independent of order
-
hasSameColumns
public boolean hasSameColumns(int[] indexes)
Returns true if the specified array of column-indexes has the same columns as this object, independent of order.- Parameters:
indexes
- the array of indexes to compare to this object- Returns:
- true if the two objects have the same column indexes, independent of order
-
getConstraintName
public java.lang.String getConstraintName()
-
setConstraintName
public void setConstraintName(java.lang.String constraintName)
-
getConstraintType
public TableConstraintType getConstraintType()
-
setConstraintType
public void setConstraintType(TableConstraintType constraintType)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-