|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.document.interval.DOMIntervalSet
public final class DOMIntervalSet
An ordered set of disjunctive non-empty intervals. Mutable, thread unsafe.
References live instance of the document - the interval may become invalid when the document is changed.
Constructor Summary | |
---|---|
DOMIntervalSet(DomCore doc)
Constructs an empty set. |
|
DOMIntervalSet(DomCore doc,
DOMInterval interval)
Constructs set with one item. |
|
DOMIntervalSet(DomCore doc,
DOMIntervalSet other)
Copy-constructor. |
Method Summary | |
---|---|
void |
clear()
Removes all intervals from this set. |
List<IDSelectionAction> |
complement()
Inverts the interval set - all nodes that were not part of the set will become contents of the set and vice versa. |
boolean |
contains(DOMInterval interval)
Checks if this set fully covers given interval. |
boolean |
equals(Object obj)
|
IntervalOrInsertPoint |
findIntervalOrInsertPoint(DomPointer ptr)
Finds index of interval that contains given pointer, or an insert point where interval starting with given pointer would be inserted. |
Set<String> |
getContentIds()
Returns set of IDs, covered (partially) by some interval(s). |
List<DOMInterval> |
getIntervals()
Returns an list of all intervals. |
int |
hashCode()
|
DOMIntervalSet |
intersect(DOMInterval interval)
Intersects given interval with this set. |
DOMIntervalSet |
intersect(DOMIntervalSet other)
Intersects given set with this set. |
boolean |
isEmpty()
Checks if this set covers at least one node (or some characters of some node). |
Iterator<DOMInterval> |
iterator()
|
DOMIntervalSet |
subtract(DOMInterval interval)
Subtracts given interval to this interval set. |
DOMIntervalSet |
subtract(DOMIntervalSet other)
Subtracts all intervals from given set to this interval set. |
List<IDSelectionAction> |
toSelectionActions(boolean select)
Returns this set as a list of IDSelectionAction elements. |
String |
toString()
|
DOMIntervalSet |
union(DOMInterval interval)
Adds given interval to this interval set. |
DOMIntervalSet |
union(DOMIntervalSet other)
Adds all intervals from given set to this interval set. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
DOMIntervalSet(DomCore doc)
doc
- owner document.DOMIntervalSet(DomCore doc, DOMIntervalSet other)
doc
- owner document.other
- clone this interval set.DOMIntervalSet(DomCore doc, DOMInterval interval)
doc
- owner document.interval
- the interval.Method Detail |
---|
public Iterator<DOMInterval> iterator()
iterator
in interface Iterable<DOMInterval>
public List<DOMInterval> getIntervals()
public Set<String> getContentIds()
public DOMIntervalSet union(DOMInterval interval)
O(log(|this|))
in worst case.
interval
- interval to add. Adjacent nodes are merged automatically.
null
.public DOMIntervalSet union(DOMIntervalSet other)
|other|.O(log(|this|))
in worst case.
other
- set of intervals to add. Adjacent nodes are merged
automatically.
null
.public DOMIntervalSet subtract(DOMInterval interval)
O(log(|this|))
in worst case.
interval
- interval to subtract.
null
.public DOMIntervalSet subtract(DOMIntervalSet other)
|other|.O(log(|this|))
in worst case.
other
- set of intervals to add.
null
.public DOMIntervalSet intersect(DOMIntervalSet other)
|other|.O(log(|this|))
in worst case.
other
- the set to intersect with.
null
.public DOMIntervalSet intersect(DOMInterval interval)
O(log(|this|))
in the worst case.
interval
- the set to intersect with.
null
.public boolean contains(DOMInterval interval)
O(log(|this|))
in worst case.
interval
- interval to check
true
if all content of given interval is fully
covered by the set, false
if some nodes (or parts of
nodes) are outside the set.public List<IDSelectionAction> complement()
null
.public List<IDSelectionAction> toSelectionActions(boolean select)
IDSelectionAction
elements.
select
- the value of the IDSelectionAction.select
attribute
for all returned instances.
null
, may be empty if this set is
empty.public boolean isEmpty()
isEmpty
in interface ISelection
true
if this set is empty, false
if
it contains at least one non-empty interval.public IntervalOrInsertPoint findIntervalOrInsertPoint(DomPointer ptr)
Finds index of interval that contains given pointer, or an insert point where interval starting with given pointer would be inserted. This will take O(log(n)) in worst case.
ptr
- pointer to check.
IntervalOrInsertPoint
class providing
information about the pointer.public void clear()
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |