|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
javax.swing
|
Constructor Summary | |
---|---|
SizeSequence()
Creates a new SizeSequence object
that contains no entries. |
|
SizeSequence(int numEntries)
Creates a new SizeSequence object
that contains the specified number of entries,
all initialized to have size 0. |
|
SizeSequence(int[] sizes)
Creates a new SizeSequence object
that contains the specified sizes. |
|
SizeSequence(int numEntries,
int value)
Creates a new SizeSequence object
that contains the specified number of entries,
all initialized to have size value . |
Method Summary | |
---|---|
int |
getIndex(int position)
Returns the index of the entry that corresponds to the specified position. |
int |
getPosition(int index)
Returns the start position for the specified entry. |
int |
getSize(int index)
Returns the size of the specified entry. |
int[] |
getSizes()
Returns the size of all entries. |
void |
insertEntries(int start,
int length,
int value)
Adds a contiguous group of entries to this SizeSequence . |
void |
removeEntries(int start,
int length)
Removes a contiguous group of entries from this SizeSequence . |
void |
setSize(int index,
int size)
Sets the size of the specified entry. |
void |
setSizes(int[] sizes)
Resets this SizeSequence object,
using the data in the sizes argument. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SizeSequence()
SizeSequence
object
that contains no entries. To add entries, you
can use insertEntries
or setSizes
.
public SizeSequence(int numEntries)
SizeSequence
object
that contains the specified number of entries,
all initialized to have size 0.
numEntries
- the number of sizes to track
NegativeArraySizeException
- if
numEntries < 0
public SizeSequence(int numEntries, int value)
SizeSequence
object
that contains the specified number of entries,
all initialized to have size value
.
numEntries
- the number of sizes to trackvalue
- the initial value of each sizepublic SizeSequence(int[] sizes)
SizeSequence
object
that contains the specified sizes.
sizes
- the array of sizes to be contained in
the SizeSequence
Method Detail |
---|
public void setSizes(int[] sizes)
SizeSequence
object,
using the data in the sizes
argument.
This method reinitializes this object so that it
contains as many entries as the sizes
array.
Each entry's size is initialized to the value of the
corresponding item in sizes
.
sizes
- the array of sizes to be contained in
this SizeSequence
public int[] getSizes()
public int getPosition(int index)
getPosition(0)
returns 0,
getPosition(1)
is equal to
getSize(0)
,
getPosition(2)
is equal to
getSize(0)
+ getSize(1)
,
and so on.
Note that if index
is greater than
length
the value returned may
be meaningless.
index
- the index of the entry whose position is desired
public int getIndex(int position)
getIndex(0)
is 0,
since the first entry always starts at position 0.
position
- the position of the entry
public int getSize(int index)
index
is out of the range
(0 <= index < getSizes().length)
the behavior is unspecified.
index
- the index corresponding to the entry
public void setSize(int index, int size)
index
does not fall in the range:
(0 <= index < getSizes().length)
the behavior is unspecified.
index
- the index corresponding to the entrysize
- the size of the entrypublic void insertEntries(int start, int length, int value)
SizeSequence
.
Note that the values of start
and
length
must satisfy the following
conditions: (0 <= start < getSizes().length)
AND (length >= 0)
. If these conditions are
not met, the behavior is unspecified and an exception
may be thrown.
start
- the index to be assigned to the first entry
in the grouplength
- the number of entries in the groupvalue
- the size to be assigned to each new entry
ArrayIndexOutOfBoundsException
- if the parameters
are outside of the range:
(0 <= start < (getSizes().length)) AND (length >= 0)
public void removeEntries(int start, int length)
SizeSequence
.
Note that the values of start
and
length
must satisfy the following
conditions: (0 <= start < getSizes().length)
AND (length >= 0)
. If these conditions are
not met, the behavior is unspecified and an exception
may be thrown.
start
- the index of the first entry to be removedlength
- the number of entries to be removed