Class FieldSelection
- java.lang.Object
-
- docking.widgets.fieldpanel.support.FieldSelection
-
- All Implemented Interfaces:
java.lang.Iterable<FieldRange>
public class FieldSelection extends java.lang.Object implements java.lang.Iterable<FieldRange>
Interface for reporting the FieldViewer selection. The selection consists of a sequence of ranges of indexes.
-
-
Constructor Summary
Constructors Constructor Description FieldSelection()
Construct a new empty FieldSelection.FieldSelection(FieldSelection selection)
Construct a new FieldSelection with the same selection as the given FieldSelection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRange(int startIndex, int endIndex)
Add the all the indexes from startIndex to endIndex to the selection.void
addRange(int startIndex, int startFieldNum, int endIndex, int endFieldNum)
void
addRange(FieldLocation start, FieldLocation end)
Adds a field range to this selection.void
addRange(FieldRange range)
void
addRange(java.math.BigInteger startIndex, int startFieldNum, java.math.BigInteger endIndex, int endFieldNum)
void
addRange(java.math.BigInteger startIndex, java.math.BigInteger endIndex)
void
clear()
Removes all indexes from the list.boolean
contains(FieldLocation loc)
Returns true if the given Field at the given index is in the selection.boolean
containsEntirely(FieldRange range)
boolean
containsEntirely(java.math.BigInteger index)
Returns true if the all the fields in the layout with the given index are included in this selection.void
delete(FieldSelection selection)
Delete all fields in the ranges in the given field selection from this one.boolean
equals(java.lang.Object obj)
boolean
excludesEntirely(FieldRange range)
boolean
excludesEntirely(java.math.BigInteger index)
FieldSelection
findIntersection(FieldSelection selection)
Computes the intersection of this field selection and the given field selection.FieldRange
getFieldRange(int rangeNum)
Returns the i'th Field Range in the selection.int
getNumRanges()
Returns the current number of ranges in the list.FieldRange
getRangeContaining(FieldLocation loc)
Returns the range if the given Field at the given index is in the selection.void
insert(FieldSelection selection)
Insert all fields in the ranges in the given field selection from this one.FieldSelection
intersect(int index)
FieldSelection
intersect(FieldRange range)
void
intersect(FieldSelection selection)
Compute the intersection of this field selection and another one.FieldSelection
intersect(java.math.BigInteger index)
boolean
isEmpty()
java.util.Iterator<FieldRange>
iterator()
void
load(SaveState saveState)
void
printRanges()
Prints out the ranges for debugging.void
removeRange(int startIndex, int endIndex)
Removes the all the fields in the index range from the selection.void
removeRange(FieldLocation start, FieldLocation end)
Removes the given field range from the current selection.void
removeRange(java.math.BigInteger startIndex, java.math.BigInteger endIndex)
void
save(SaveState saveState)
java.lang.String
toString()
-
-
-
Constructor Detail
-
FieldSelection
public FieldSelection()
Construct a new empty FieldSelection.
-
FieldSelection
public FieldSelection(FieldSelection selection)
Construct a new FieldSelection with the same selection as the given FieldSelection.- Parameters:
selection
- the FieldSelection to copy.
-
-
Method Detail
-
clear
public void clear()
Removes all indexes from the list.
-
contains
public boolean contains(FieldLocation loc)
Returns true if the given Field at the given index is in the selection.- Parameters:
loc
- the field location.- Returns:
- true if the field selection contains the specified location.
-
getRangeContaining
public FieldRange getRangeContaining(FieldLocation loc)
Returns the range if the given Field at the given index is in the selection. Otherwise returns null.- Parameters:
loc
- location to find the range for.
-
containsEntirely
public boolean containsEntirely(java.math.BigInteger index)
Returns true if the all the fields in the layout with the given index are included in this selection.- Parameters:
index
- index of the layout to test.
-
containsEntirely
public boolean containsEntirely(FieldRange range)
-
excludesEntirely
public boolean excludesEntirely(FieldRange range)
-
excludesEntirely
public boolean excludesEntirely(java.math.BigInteger index)
-
addRange
public void addRange(FieldLocation start, FieldLocation end)
Adds a field range to this selection.- Parameters:
start
- the starting field location.end
- the ending field location.
-
addRange
public void addRange(int startIndex, int endIndex)
Add the all the indexes from startIndex to endIndex to the selection. The added range includes the startIndex, but not the endIndex.- Parameters:
startIndex
- the start index of the layouts to includeendIndex
- the end index(not inclusive) of the layouts to include
-
addRange
public void addRange(java.math.BigInteger startIndex, java.math.BigInteger endIndex)
-
addRange
public void addRange(int startIndex, int startFieldNum, int endIndex, int endFieldNum)
-
addRange
public void addRange(java.math.BigInteger startIndex, int startFieldNum, java.math.BigInteger endIndex, int endFieldNum)
-
removeRange
public void removeRange(FieldLocation start, FieldLocation end)
Removes the given field range from the current selection.- Parameters:
start
- the starting field location.end
- the ending field location.
-
removeRange
public void removeRange(int startIndex, int endIndex)
Removes the all the fields in the index range from the selection.- Parameters:
startIndex
- the first index in the range to remove.endIndex
- the last index in the range to remove.
-
removeRange
public void removeRange(java.math.BigInteger startIndex, java.math.BigInteger endIndex)
-
getNumRanges
public int getNumRanges()
Returns the current number of ranges in the list.
-
getFieldRange
public FieldRange getFieldRange(int rangeNum)
Returns the i'th Field Range in the selection.- Parameters:
rangeNum
- the index of the range to retrieve.
-
intersect
public final void intersect(FieldSelection selection)
Compute the intersection of this field selection and another one. The intersection of two field selections is all fields existing in both selections.Note: This field selection becomes the intersection.
- Parameters:
selection
- field selection to intersect.
-
findIntersection
public final FieldSelection findIntersection(FieldSelection selection)
Computes the intersection of this field selection and the given field selection.- Parameters:
selection
- the selection to intersect with.
-
delete
public final void delete(FieldSelection selection)
Delete all fields in the ranges in the given field selection from this one.- Parameters:
selection
- the field selection fields to remove from this field selection.
-
insert
public final void insert(FieldSelection selection)
Insert all fields in the ranges in the given field selection from this one.- Parameters:
selection
- the field selection fields to add to this field selection.
-
printRanges
public void printRanges()
Prints out the ranges for debugging.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(java.lang.Object)
-
save
public void save(SaveState saveState)
-
load
public void load(SaveState saveState)
-
isEmpty
public boolean isEmpty()
-
intersect
public FieldSelection intersect(int index)
-
intersect
public FieldSelection intersect(java.math.BigInteger index)
-
intersect
public FieldSelection intersect(FieldRange range)
-
addRange
public void addRange(FieldRange range)
-
iterator
public java.util.Iterator<FieldRange> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<FieldRange>
-
-