|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlp.trans.IntArrayWrapper
class IntArrayWrapper
A class used for storing an increasing sequence of nonnegative integers.
It is very simple and error-prone. Designed only for internal use by the
DlpTransformer
and EvolpTransformer
classes.
Field Summary | |
---|---|
private int[] |
members
An array with the sequence's members. |
private int |
top
Index of the getTop element. |
Constructor Summary | |
---|---|
IntArrayWrapper(int maxCount)
Constructs a new instance which can hold up to maxCount
elements. |
Method Summary | |
---|---|
void |
add(int newMember)
Adds a new element to the sequence. |
boolean |
contains(int number)
Returns true iff this sequence contains number . |
int |
get(int i)
Returns the i-th member of this sequence. |
int |
getMax()
|
int |
getMaxLeqThan(int limit)
Returns the maximum element of this sequence that is less or equal than limit , or -1 if no such element exists. |
int |
getTop()
Returns the index of the last element. |
boolean |
isEmpty()
Returns true iff this sequence has 0 elements. |
int |
length()
Returns current number of elements in this sequence. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final int[] members
private int top
Constructor Detail |
---|
public IntArrayWrapper(int maxCount)
maxCount
elements.
maxCount
- capacity of this instanceMethod Detail |
---|
public void add(int newMember)
newMember
- candidate for a new member of this sequencepublic int length()
public int getTop()
public int get(int i)
i
is a valid member index.
i
-
public int getMax()
public int getMaxLeqThan(int limit)
limit
, or -1 if no such element exists.
limit
- upper limit for the element returned
limit
, or -1 if no such element exists.public boolean contains(int number)
true
iff this sequence contains number
.
number
- the element to search for
true
if this sequence contains number
,
false
otherwisepublic boolean isEmpty()
true
iff this sequence has 0 elements.
true
if this sequence has 0 elements, false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |