DataRelationCollection

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public final class DataRelationCollection implements Iterable

Represents the collection of DataRelation objects for this DataSet.

Methods

Method Description
add(DataRelation relation) Adds a DataRelation to the DataRelationCollection.
add(DataTable parentTable, DataTable childTable, String parentColumnName, String childColumnName) Adds a relation to the collection.
add(DataTable parentTable, DataTable childTable, String[] parentColumnNames, String[] childColumnNames) Adds a relation to the collection.
add(String name, DataColumn parentColumn, DataColumn childColumn, boolean createConstraints) Creates a DataRelation with the specified name, parent and child columns, with optional constraints according to the value of the createConstraints parameter, and adds it to the collection.
add(DataColumn parentColumn, DataColumn childColumn) Creates a DataRelation with a specified parent and child column, and adds it to the collection.
add(String name, DataColumn parentColumn, DataColumn childColumn) Creates a DataRelation with the specified name, and parent and child columns, and adds it to the collection.
iterator()
getCount()
contains(DataRelation relation) Verifies whether a DataRelation with the specific name (case insensitive) exists in the collection.
indexOf(DataRelation relation) Gets the index of the specified DataRelation object.
get(String name) Gets the DataRelation object specified by name.
get(int index) Gets the DataRelation object at the specified index.
removeAt(int index) Removes the relation at the specified index from the collection.
clear() Clears the collection of any relations.

add(DataRelation relation)

public final void add(DataRelation relation)

Adds a DataRelation to the DataRelationCollection.

Parameters:

Parameter Type Description
relation DataRelation The DataRelation to add to the collection.

add(DataTable parentTable, DataTable childTable, String parentColumnName, String childColumnName)

public final void add(DataTable parentTable, DataTable childTable, String parentColumnName, String childColumnName)

Adds a relation to the collection. Performs no checks on the duplication etc.

Parameters:

Parameter Type Description
parentTable DataTable The parent table of the relation.
childTable DataTable The child table of the relation.
parentColumnName java.lang.String The parent column’s name of the relation.
childColumnName java.lang.String The child column’s name of the relation.

add(DataTable parentTable, DataTable childTable, String[] parentColumnNames, String[] childColumnNames)

public final void add(DataTable parentTable, DataTable childTable, String[] parentColumnNames, String[] childColumnNames)

Adds a relation to the collection. Performs no checks on the duplication etc.

Parameters:

Parameter Type Description
parentTable DataTable The parent table of the relation.
childTable DataTable The child table of the relation.
parentColumnNames java.lang.String[] The array of parent column’s name of the relation.
childColumnNames java.lang.String[] The array of child column’s name of the relation.

add(String name, DataColumn parentColumn, DataColumn childColumn, boolean createConstraints)

public final void add(String name, DataColumn parentColumn, DataColumn childColumn, boolean createConstraints)

Creates a DataRelation with the specified name, parent and child columns, with optional constraints according to the value of the createConstraints parameter, and adds it to the collection.

Parameters:

Parameter Type Description
name java.lang.String The name of the relation.
parentColumn DataColumn The parent column of the relation.
childColumn DataColumn The child column of the relation.
createConstraints boolean true to create constraints; otherwise false. (The default is true).

add(DataColumn parentColumn, DataColumn childColumn)

public final void add(DataColumn parentColumn, DataColumn childColumn)

Creates a DataRelation with a specified parent and child column, and adds it to the collection.

Parameters:

Parameter Type Description
parentColumn DataColumn The parent column of the relation.
childColumn DataColumn The child column of the relation.

add(String name, DataColumn parentColumn, DataColumn childColumn)

public final void add(String name, DataColumn parentColumn, DataColumn childColumn)

Creates a DataRelation with the specified name, and parent and child columns, and adds it to the collection.

Parameters:

Parameter Type Description
name java.lang.String The name of the relation.
parentColumn DataColumn The parent column of the relation.
childColumn DataColumn The child column of the relation.

iterator()

public final Iterator iterator()

Returns: java.util.Iterator

getCount()

public final int getCount()

Returns: int - the total number of elements in a collection

contains(DataRelation relation)

public final boolean contains(DataRelation relation)

Verifies whether a DataRelation with the specific name (case insensitive) exists in the collection.

Parameters:

Parameter Type Description
relation DataRelation The name of the relation to find.

Returns: boolean - true, if a relation with the specified name exists; otherwise false.

indexOf(DataRelation relation)

public final int indexOf(DataRelation relation)

Gets the index of the specified DataRelation object.

Parameters:

Parameter Type Description
relation DataRelation The relation to search for.

Returns: int - The 0-based index of the relation, or -1 if the relation is not found in the collection.

get(String name)

public final DataRelation get(String name)

Gets the DataRelation object specified by name.

Parameters:

Parameter Type Description
name java.lang.String The name of the relation to find.

Returns: DataRelation - The named DataRelation, or a null value if the specified DataRelation does not exist.

get(int index)

public final DataRelation get(int index)

Gets the DataRelation object at the specified index.

Parameters:

Parameter Type Description
index int The zero-based index to find.

Returns: DataRelation - The DataRelation, or a null value if the specified DataRelation does not exist.

removeAt(int index)

public final void removeAt(int index)

Removes the relation at the specified index from the collection.

Parameters:

Parameter Type Description
index int The index of the relation to remove.

clear()

public final void clear()

Clears the collection of any relations.