public class ModuleSpec extends Object implements Cloneable
The attributes to use are defined by a hierarchy. The hierarchy is:
Modifier and Type | Field and Description |
---|---|
protected Object[] |
compDef
The default value for each component.
|
protected Object |
def
Default value for each tile-component
|
protected int |
nComp
The number of components
|
protected int |
nTiles
The number of tiles
|
static byte |
SPEC_COMP_DEF
The identifier for "component default" specification
|
static byte |
SPEC_DEF
The identifier for default specification
|
static byte |
SPEC_TILE_COMP
The identifier for a "tile-component" specification
|
static byte |
SPEC_TILE_DEF
The identifier for "tile default" specification
|
static byte |
SPEC_TYPE_COMP
The identifier for a specification module that applies only to
components
|
static byte |
SPEC_TYPE_TILE
The identifier for a specification module that applies only to
tiles
|
static byte |
SPEC_TYPE_TILE_COMP
The identifier for a specification module that applies both to
tiles and components
|
protected String |
specified
The specified value in string format
|
protected int |
specType
The type of the specification module
|
protected byte[][] |
specValType
The spec type for each tile-component.
|
protected Hashtable |
tileCompVal
The specific value for each tile-component.
|
protected Object[] |
tileDef
The default value for each tile.
|
Constructor and Description |
---|
ModuleSpec(int nt,
int nc,
byte type)
Constructs a 'ModuleSpec' object, initializing all the components and
tiles to the 'SPEC_DEF' spec val type, for the specified number of
components and tiles.
|
Modifier and Type | Method and Description |
---|---|
protected Object |
clone() |
Object |
getCompDef(int c)
Gets default value of the specified component.
|
ModuleSpec |
getCopy() |
Object |
getDefault()
Gets default value for this module.
|
protected Object |
getSpec(int t,
int c)
Gets value of specified tile-component without knowing if a
specific tile-component value has been previously entered.
|
byte |
getSpecValType(int t,
int c)
Return the spec type of the given tile-component.
|
Object |
getTileCompVal(int t,
int c)
Gets value of specified tile-component.
|
Object |
getTileDef(int t)
Gets default value of the specified tile.
|
boolean |
isCompSpecified(int c)
Whether or not specifications have been entered for the given
component.
|
boolean |
isTileCompSpecified(int t,
int c)
Whether or not a tile-component specification has been defined
|
boolean |
isTileSpecified(int t)
Whether or not specifications have been entered for the given
tile.
|
static boolean[] |
parseIdx(String word,
int maxIdx)
This method is responsible of parsing tile indexes set and
component indexes set for an option.
|
void |
rotate90(Point anT)
Rotate the ModuleSpec instance by 90 degrees (this modifies only tile
and tile-component specifications).
|
void |
setCompDef(int c,
Object value)
Sets default value for specified component and specValType tag if
allowed by its priority.
|
void |
setDefault(Object value)
Sets default value for this module
|
void |
setTileCompVal(int t,
int c,
Object value)
Sets value for specified tile-component.
|
void |
setTileDef(int t,
Object value)
Sets default value for specified tile and specValType tag if
allowed by its priority.
|
public static final byte SPEC_TYPE_COMP
public static final byte SPEC_TYPE_TILE
public static final byte SPEC_TYPE_TILE_COMP
public static final byte SPEC_DEF
public static final byte SPEC_COMP_DEF
public static final byte SPEC_TILE_DEF
public static final byte SPEC_TILE_COMP
protected int specType
protected int nTiles
protected int nComp
protected byte[][] specValType
protected Object def
protected Object[] compDef
protected Object[] tileDef
protected Hashtable tileCompVal
protected String specified
public ModuleSpec(int nt, int nc, byte type)
nt
- The number of tilesnc
- The number of componentstype
- the type of the specification module i.e. tile specific,
component specific or both.public ModuleSpec getCopy()
public void rotate90(Point anT)
nT
- Number of tiles along horizontal and vertical axis after
rotation.public void setDefault(Object value)
public Object getDefault()
public void setCompDef(int c, Object value)
c
- Component indexpublic Object getCompDef(int c)
c
- Component indexsetCompDef(int, java.lang.Object)
public void setTileDef(int t, Object value)
c
- Tile index.public Object getTileDef(int t)
t
- Tile indexsetTileDef(int, java.lang.Object)
public void setTileCompVal(int t, int c, Object value)
t
- Tie indexc
- Component indexpublic Object getTileCompVal(int t, int c)
t
- Tile indexc
- Component indexsetTileCompVal(int, int, java.lang.Object)
,
getSpec(int, int)
protected Object getSpec(int t, int c)
t
- Tile indexc
- Component indexpublic byte getSpecValType(int t, int c)
t
- Tile indexc
- Component indexpublic boolean isCompSpecified(int c)
c
- Index of the componentpublic boolean isTileSpecified(int t)
t
- Index of the tilepublic boolean isTileCompSpecified(int t, int c)
t
- Tile indexc
- Component indexpublic static final boolean[] parseIdx(String word, int maxIdx)
Example:
word
- The word to parse.maxIdx
- Maximum authorized indexCopyright © 2015–2022 SCIFIO. All rights reserved.