public class RowLink extends java.lang.Object implements java.lang.Comparable<RowLink>
RowRef
s
which are considered in some way linked to each other.
Although it doesn't implement the SortedSet
interface
(being immutable this wouldn't gain you much) its spirit is that of
a sorted set - its equals and hashCode methods
are implemented such that two RowLinks which contain
equivalent groups of RowRef objects are considered the same.
This makes RowLink instances suitable for use
as keys in hashes that should not contain duplicate entries for
duplicate links.
The getRef method returns RowRefs
in their natural order.Constructor and Description |
---|
RowLink(java.util.Collection<RowRef> rows)
Constructs a new RowLink from a Collection of
RowRef objects. |
RowLink(RowRef row)
Convenience constructor to construct a singleton RowLink.
|
RowLink(RowRef[] rows)
Constructs a new RowLink from an array of RowRef objects.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(RowLink other)
Comparison order compares first table (if present in both objects)
first, etc.
|
boolean |
equals(java.lang.Object o)
Assesses equality.
|
RowRef |
getRef(int i)
Returns the ith row ref in this link.
|
int |
hashCode()
Returns a hash code which is consistent with the
equals method.
|
int |
size()
Returns the number of rows linked by this object.
|
java.lang.String |
toString() |
public RowLink(java.util.Collection<RowRef> rows)
RowRef
objects.
An unchecked exception will be thrown if rows contains some
elements which are not instances of RowRef.rows
- collection of RowRef objectspublic RowLink(RowRef[] rows)
rows
- array of row referencespublic RowLink(RowRef row)
row
- sole rowpublic int size()
public RowRef getRef(int i)
i
- indexpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(RowLink other)
compareTo
in interface java.lang.Comparable<RowLink>
public java.lang.String toString()
toString
in class java.lang.Object