|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.core.ParameterContainer
Class able to store parameter sets. ParameterContainers are used for example by Painters to get local information and additional parameter objects which may be relevant for the drawing process.
Constructor Summary | |
ParameterContainer(int length)
Creates a new ParamterContainer which is able to store up to length
parameter objects. |
|
ParameterContainer(java.lang.Object o)
Constructor receiving an java.lang.Object . |
|
ParameterContainer(java.lang.Object[] oa,
int offset,
int length)
Constructor receiving a subarray of java.lang.Object s. |
Method Summary | |
boolean |
getBoolean(int index)
Returns the parameter with index index as a boolean value, if possible.
|
double |
getDouble(int index)
Returns the parameter with index index as a double value, if possible.
|
float |
getFloat(int index)
Returns the parameter with index index as a float value, if possible.
|
int |
getInt(int index)
Returns the parameter with index index as an int value, if possible.
|
long |
getLong(int index)
Returns the parameter with index index as a long value, if possible.
|
short |
getShort(int index)
Returns the parameter with index index as a short value, if possible.
|
int |
globalLength()
Returns the total number of storable parameters for this ParameterContainer . |
int |
length()
Returns the length of the visible part of the parameters array. |
int |
offset()
Returns the offset index of the visible part of the parameters array. |
java.lang.Object |
parameter(int index)
Returns the parameter with index index , i.e. the index+1 -th within
the setted mask. |
java.lang.Object[] |
parameter(int offset,
int length)
Returns a subarray of paramter objects. |
java.awt.Point |
point(int index)
Returns the parameter with index index , i.e. the index+1 -th one within
the visible part of the parameters array as a java.awt.Point . |
java.awt.Point[] |
point(int offset,
int length)
Returns a subarray of paramter objects as a java.awt.Point array. |
void |
setLength(int length)
Sets the length of the visible part of the parameter array. |
void |
setMask(int offset,
int length)
Sets the mask to the given values, i.e. the offset index of the visible part of the parameters will be set to index and the number of visible parameters will
be set to length . |
void |
setOffset(int offset)
Sets the offset index of the visible part of the parameter array. |
void |
setParameter(int index,
boolean b)
Sets a boolean -value as parameter with index index .
|
void |
setParameter(int index,
double d)
Sets a double -value as parameter with index index .
|
void |
setParameter(int index,
float f)
Sets a float -value as parameter with index index .
|
void |
setParameter(int index,
int i)
Sets an int -value as parameter with index index .
|
void |
setParameter(int index,
long l)
Sets a long -value as parameter with index index .
|
void |
setParameter(int index,
java.lang.Object o)
Sets o as new parameter object at index index within the
visible mask of the parameter array. |
void |
setParameter(int offset,
java.lang.Object[] oa,
int ooffset,
int length)
Sets a subarray of new parameter objects. |
void |
setParameter(int index,
short s)
Sets a short -value as parameter with index index .
|
void |
setParameterGlobal(int index,
java.lang.Object o)
Sets o as new parameter object at index index within the
the parameter array, i.e. |
void |
setParameterGlobal(int offset,
java.lang.Object[] oa,
int ooffset,
int length)
Sets a subarray of new parameter objects. |
void |
setParameterPoint(int index,
int x,
int y)
Sets the given point (x,y) as new parameter object (of type
java.awt.Point ) at index index within the
visible mask of the parameter array. |
java.lang.String |
toString()
Overridden toString -method which returns a string of the form
"gishur.core.ParameterContainer[offset=...,length=...,{-parameters-}]", where
offset is the offset of the visible part of the parameter array and
length is its length. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public ParameterContainer(int length)
length
parameter objects.public ParameterContainer(java.lang.Object o)
java.lang.Object
.public ParameterContainer(java.lang.Object[] oa, int offset, int length)
java.lang.Object
s.pa
- the source array containing the Object
soffset
- the first element to copy as a parameterlength
- the number of Object
s to copyMethod Detail |
public java.lang.String toString()
toString
-method which returns a string of the form
"gishur.core.ParameterContainer[offset=...,length=...,{-parameters-}]", where
offset is the offset of the visible part of the parameter array and
length is its length.ParameterContainer
public void setOffset(int offset)
offset
has an invalid value, the offset is set to an invalid value and the length of the visible
part is set to zero. If the new offset
is bigger than the old one and the
length of the visible part would become invalid by this, the length will be decreased until
it reaches the end of the parameter array.the
- new offset index of the maskpublic void setLength(int length)
length
,
counted from the offset of the visible mask, would exceed the valid indices, it will be
increased to the maximal valid value, i.e. the visible part is enlarged to the end of
the parameter array.length
- the new length of the maskpublic void setMask(int offset, int length)
index
and the number of visible parameters will
be set to length
. If offset
has an invalid value or if
offset+length
would exceed the valid indices, the same rules as in
setLength(int)
and setOffset(int)
are applied.offset
- the offset index of the visible part of the parameterslength
- the number of visible parameterspublic int offset()
public int length()
public int globalLength()
ParameterContainer
.ParameterContainer
public java.lang.Object parameter(int index)
index
, i.e. the index+1
-th within
the setted mask.index
- index of the parameter to returnindex
-th visible parameter, or null
, if index
has
an invalid valuepublic java.lang.Object[] parameter(int offset, int length)
length
elements stored in the visible mask of this ParameterContainer
following index
offset
(inclusive).offset
- first parameter to return (within the visible part)length
- number of parameters to returnnumber
parameter obects, or null
, if
offset
has an invalid value or if offset+length
exceeds the
valid indicespublic java.awt.Point point(int index)
index
, i.e. the index+1
-th one within
the visible part of the parameters array as a java.awt.Point
.index
- index of the parameter to return as a Point
index
-th visible parameter, or null
, if index
has
an invalid value or if it is not a java.awt.Point
public java.awt.Point[] point(int offset, int length)
java.awt.Point
array. The returned array
contains the length
elements stored in the visible mask of this ParameterContainer
following index offset
(inclusive) casted to Point
s.offset
- first parameter to return (within the visible part)length
- number of parameters to returnnumber Points
, or null
, if
offset
has an invalid value or if offset+length
exceeds the
valid indices or if at least one of the parameter objects is not a Point
public int getInt(int index)
index
as an int
value, if possible.
Otherwise, the maximal possible value will be returned.public short getShort(int index)
index
as a short
value, if possible.
Otherwise, the maximal possible value will be returned.public long getLong(int index)
index
as a long
value, if possible.
Otherwise, the maximal possible value will be returned.public float getFloat(int index)
index
as a float
value, if possible.
Otherwise, the maximal possible value will be returned.public double getDouble(int index)
index
as a double
value, if possible.
Otherwise, the maximal possible value will be returned.public boolean getBoolean(int index)
index
as a boolean
value, if possible.
Otherwise, false
will be returned.public void setParameter(int index, java.lang.Object o)
o
as new parameter object at index index
within the
visible mask of the parameter array. Nothing happens if index
is invalid.index
- the index (counted from the offset of the visible mask) of the parameter
to seto
- the new parameter objectpublic void setParameter(int offset, java.lang.Object[] oa, int ooffset, int length)
length
new parameters are
taken from oa
, following index ooffset
and are placed at
the visible parameter mask at index offset
and following indices.
Nothing happens, if offset
or ooffset are invalid or if
oa does not provide enough elements or if offset+length
would exceed the
valid indices.offset
- the offset index for the mask of visible parametersoa
- the source array containing the new parametersooffset
- the offset index for oa
length
- the number of objects to copypublic void setParameterPoint(int index, int x, int y)
(x,y)
as new parameter object (of type
java.awt.Point
) at index index
within the
visible mask of the parameter array. Nothing happens if index
is invalid.index
- the index (counted from the offset of the visible mask) of the
parameter to setx,y
- the new pointpublic void setParameter(int index, int i)
int
-value as parameter with index index
.
If index
is invalid, nothing happens.index
- the index of the parameter to seti
- the int-value to set as parameterpublic void setParameter(int index, short s)
short
-value as parameter with index index
.
If index
is invalid, nothing happens.index
- the index of the parameter to sets
- the short-value to set as parameterpublic void setParameter(int index, long l)
long
-value as parameter with index index
.
If index
is invalid, nothing happens.index
- the index of the parameter to setl
- the long-value to set as parameterpublic void setParameter(int index, float f)
float
-value as parameter with index index
.
If index
is invalid, nothing happens.index
- the index of the parameter to setf
- the float-value to set as parameterpublic void setParameter(int index, double d)
double
-value as parameter with index index
.
If index
is invalid, nothing happens.index
- the index of the parameter to setd
- the double-value to set as parameterpublic void setParameter(int index, boolean b)
boolean
-value as parameter with index index
.
If index
is invalid, nothing happens.index
- the index of the parameter to setb
- the boolean-value to set as parameterpublic void setParameterGlobal(int index, java.lang.Object o)
o
as new parameter object at index index
within the
the parameter array, i.e. index
is interpreted as an index for the whole
parameter array, not for the visible part only. Nothing happens if index
is invalid.index
- the index of the parameter
to seto
- the new parameter objectpublic void setParameterGlobal(int offset, java.lang.Object[] oa, int ooffset, int length)
length
new parameters are
taken from oa
, following index offset
and are placed at
index offset
and following indices in the parameter array.
Remark that this method interprets offset
as an index for the whole
parameter array, not for the visible part only (like setParameter(int,Object[],int,int)
).
Nothing happens, if offset
or ooffset are invalid or if
oa does not provide enough elements or if offset+length
would exceed the
valid indices.offset
- the offset index for the new parametersoa
- the source array containing the new parametersooffset
- the offset index for oa
length
- the number of objects to copy
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |