public interface NumberSet<N extends java.lang.Number>
Modifier and Type | Interface and Description |
---|---|
static class |
NumberSet.Query<N extends java.lang.Number>
Specifies options for iteration over extent set.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Extent<N> extent)
Adds the given extent of numbers to the set.
|
boolean |
add(N number)
Adds the given number to the set.
|
boolean |
add(N start,
N end)
Adds an extent of numbers between start end end to the set.
|
boolean |
addAll(NumberSet<N> set)
Adds the content of the given set to this set.
|
void |
clear()
Removes all of the numbers from this set.
|
boolean |
contains(Extent<N> extent)
Returns
true if this set contains all the numbers from the given range inclusively. |
boolean |
contains(N number)
Returns
true if this set contains the given number. |
boolean |
contains(N start,
N end)
Returns
true if this set contains all the numbers from the given range inclusively. |
NumberSet<N> |
copy()
Returns a copy of this set.
|
void |
delete(Extent<N> extent)
Removes a range of numbers decreasing the following numbers
by the amount of the removed items.
|
void |
delete(N number)
Removes a range of numbers decreasing the following numbers by 1.
|
void |
delete(N start,
N end)
Removes a range of numbers decreasing the following numbers
by the amount of the removed items.
|
java.util.Iterator<Extent<N>> |
extentIterator(NumberSet.Query<N> query)
Returns an extent iterator according to the given query.
|
N |
getCount()
Returns the number of items in the receiver.
|
N |
getCount(N start,
N end)
Returns the number of items in the receiver between the values
start and end inclusively. |
NumberSet<N> |
getUnchecked()
Returns a better performing but less user friendly implementation
for this number set that is more loop efficient:
does not check validity of the method arguments
does not mark the layout as required computing on every method call,
instead relying on the client to call
Matrix.refresh()
|
void |
insert(N target,
N count)
Inserts numbers before the given target number increasing the following numbers
by the amount of the inserted numbers.
|
boolean |
isEmpty()
Returns true if the receiver contains no items.
|
java.util.Iterator<N> |
numberIterator(NumberSet.Query<N> query)
Returns an number iterator according to the given query.
|
boolean |
remove(Extent<N> extent)
Removes the given extent of numbers from this set.
|
boolean |
remove(N number)
Removes the given number from this set.
|
boolean |
remove(N start,
N end)
Removes an extent of numbers between start end end from this set.
|
boolean |
removeAll(NumberSet<N> set)
Removes the content of the given set from this set.
|
boolean isEmpty()
false
is returned.N getCount()
N getCount(N start, N end)
start
and end
inclusively.start
and end
boolean add(N start, N end)
start
- first index of the range of itemsend
- last index of the range of itemstrue
if this operation has changed the set content.boolean add(N number)
number
- to be addedtrue
if this operation has changed the set content.boolean add(Extent<N> extent)
start
- first index of the range of itemsend
- last index of the range of itemstrue
if this operation has changed the set content.boolean addAll(NumberSet<N> set)
set
- to be addedtrue
if this operation has changed the set content.boolean remove(N start, N end)
start
- first index of the range of itemsend
- last index of the range of itemstrue
if this operation has changed the set content.boolean remove(N number)
number
- to remove.true
if this operation has changed the set content.boolean remove(Extent<N> extent)
start
- first index of the range of itemsend
- last index of the range of itemstrue
if this operation has changed the set content.boolean removeAll(NumberSet<N> set)
set
- to removetrue
if this operation has changed the set content.void insert(N target, N count)
Numbers are inserted before the given target number or at the end if the target equals to the (last number in the set) + 1.
target
- the number before which the new numbers are insertedcount
- the number of items to insertjava.lang.IndexOutOfBoundsException
- if target or count is null
java.lang.IndexOutOfBoundsException
- if target is out of 0 ...
getCount()
boundsjava.lang.IllegalArgumentException
- if start is greater then endvoid delete(N start, N end)
start
- first index of the range of itemsend
- last index of the range of itemsjava.lang.IndexOutOfBoundsException
- if start or end is null
java.lang.IndexOutOfBoundsException
- if start or end is negativejava.lang.IllegalArgumentException
- if start is greater then endvoid delete(N number)
number
- number to be deletedjava.lang.IndexOutOfBoundsException
- if number is null
java.lang.IndexOutOfBoundsException
- if number is negativejava.lang.IllegalArgumentException
- if start is greater then endvoid delete(Extent<N> extent)
extent
- first index of the range of items to removejava.lang.IndexOutOfBoundsException
- if extent is null
void clear()
boolean contains(N number)
true
if this set contains the given number.number
- number whose presence in this set is to be testedtrue
if this set contains the given numberboolean contains(N start, N end)
true
if this set contains all the numbers from the given range inclusively.start
- first index of the range of itemsend
- last index of the range of itemstrue
if this set contains the given range of numbersboolean contains(Extent<N> extent)
true
if this set contains all the numbers from the given range inclusively.extent
- extent of numbers whose presence in this set is to be testedtrue
if this set contains the given range of numbersjava.util.Iterator<Extent<N>> extentIterator(NumberSet.Query<N> query)
query
- parameters changing the default iteration which is forward over all items. See NumberSet.Query
.
null
value means the default query.java.util.Iterator<N> numberIterator(NumberSet.Query<N> query)
query
- parameters changing the default iteration which is forward over all items. See NumberSet.Query
.
null
value means the default query.NumberSet<N> getUnchecked()
Matrix.refresh()
Copyright © 2011 netanel.pl. All Rights Reserved.