|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--nrc.fuzzy.IntervalVector
The IntervalVector
class implements a growable array
of Intervals. Like an array, the values can be accessed using an
integer index. However, the size of an IntervalVector can
grow as needed to accommodate the addition of Intervals after the
IntervalVector has been created.
An IntervalVector is the object returned as the result of either
an alpha cut, or a request for the support of a set.
Field Summary | |
protected int |
increment
The increment amount by which the IntervalVector expands when it reaches capacity and has to insert another Interval. |
protected int |
index
The current number of Intervals in the array, and the index of the array at which the next Interval should be inserted. |
protected static int |
INITIAL_CAPACITY
The default initial capacity of the IntervalVector. |
protected nrc.fuzzy.Interval[] |
intervals
The array of Interval values. |
Constructor Summary | |
IntervalVector()
Creates an empty IntervalVector with the default initial capacity and increment values. |
|
IntervalVector(int initialCapacity)
Creates an empty IntervalVector with the specified initial capacity and the default increment value. |
|
IntervalVector(nrc.fuzzy.Interval[] IntervalArray,
int length)
Creates a IntervalVector with the length specified in the parameters, and initialized for the full length of the IntervalVector from the Interval values contained in the passed array. |
|
IntervalVector(int initialCapacity,
int increment)
Creates an empty IntervalVector with the specified initial capacity and increment value. |
Method Summary | |
void |
addInterval(nrc.fuzzy.Interval interval)
Adds a Interval to the end of the IntervalVector, increasing its size by one. |
void |
concat(nrc.fuzzy.IntervalVector other)
Concatenates the IntervalVector argument with this IntervalVector. |
void |
insertIntervalAt(nrc.fuzzy.Interval interval,
int i)
Inserts the Interval argument into the IntervalVector at the specified index. |
nrc.fuzzy.Interval |
intervalAt(int i)
Returns the Interval at the specified index. |
boolean |
isEmpty()
Tests whether or not the IntervalVector is empty, ie. |
void |
removeIntervalAt(int i)
Removes the Interval from the IntervalVector at the specified index. |
void |
setIntervalAt(nrc.fuzzy.Interval interval,
int i)
Sets the Interval in the IntervalVector at the specified index. |
int |
size()
Returns the size of the IntervalVector, or the number of Intervals in the IntervalVector. |
nrc.fuzzy.Interval[] |
toIntervalArray()
Returns the array of Intervals, trimmed to size, that this IntervalVector contains. |
java.lang.String |
toString()
|
void |
trimToSize()
Trims the capacity of this IntervalVector to be the IntervalVector's current size. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final int INITIAL_CAPACITY
protected int increment
protected nrc.fuzzy.Interval[] intervals
protected int index
Constructor Detail |
public IntervalVector()
public IntervalVector(int initialCapacity)
initialCapacity
- the int which specifies the desired initial capacity of
the IntervalVector. This is best used it is known that
the IntervalVector will be quite large so as to avoid multiple
expansions of the IntervalVector, which is inefficient.public IntervalVector(int initialCapacity, int increment)
initialCapacity
- the int to specify the desired initial capacity of
the IntervalVector. This is best used it is known that
the IntervalVector will be quite large so as to avoid multiple
expansions of the IntervalVector, which is inefficient.increment
- the int to specify the desired increment of the IntervalVectorpublic IntervalVector(nrc.fuzzy.Interval[] IntervalArray, int length)
IntervalArray
- the array of Intervals which contains the Intervals
with which to initialize the IntervalVector.length
- this parameter is basically equivalent to the initial
capacity parameter in the other constructors. However,
it has one additional implication. It is expected
that length
is less than or equal to the length of
IntervalArray
.
java.lang.ArrayIndexOutOfBoundsException
- if the length
parameter is
greater than the length of IntervalArray
.Method Detail |
public void addInterval(nrc.fuzzy.Interval interval)
public void concat(nrc.fuzzy.IntervalVector other)
other
- the IntervalVector to concatenate onto the end of
this IntervalVectorpublic nrc.fuzzy.Interval intervalAt(int i)
i
- the index in the IntervalVector of the desired
Interval
public void setIntervalAt(nrc.fuzzy.Interval interval, int i)
i
- the index in the IntervalVector of the Interval position
that is desired to be setpublic void removeIntervalAt(int i)
i
- the position of the Interval to removepublic void insertIntervalAt(nrc.fuzzy.Interval interval, int i)
i
- the index position of the IntervalVector into which the
Interval argument is to be insertedpublic void trimToSize()
public int size()
public boolean isEmpty()
true
if the IntervalVector is empty, if
it contains zero Intervalspublic nrc.fuzzy.Interval[] toIntervalArray()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |