C# Class CSJ2K.j2k.ModuleSpec

This generic class is used to handle values to be used by a module for each tile and component. It uses attribute to determine which value to use. It should be extended by each module needing this feature. This class might be used for values that are only tile specific or component specific but not both.

The attributes to use are defined by a hierarchy. The hierarchy is:

  • Tile and component specific attribute
  • Tile specific default attribute
  • Component main default attribute
  • Main default attribute

Show file Open project: cureos/csj2k Class Usage Examples

Protected Properties

Property Type Description
compDef System.Object[]
def System.Object
nComp int
nTiles int
specType int
specValType byte[][]
tileCompVal System.Object>.System.Collections.Generic.Dictionary
tileDef System.Object[]

Public Methods

Method Description
Clone ( ) : Object
ModuleSpec ( int nt, int nc, byte type ) : System

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.

getCompDef ( int c ) : Object

Gets default value of the specified component. If no specification have been entered for this component, returns default value.

getDefault ( ) : Object

Gets default value for this module.

getSpecValType ( int t, int c ) : byte

Return the spec type of the given tile-component.

getTileCompVal ( int t, int c ) : Object

Gets value of specified tile-component. This method calls getSpec but has a public access.

getTileDef ( int t ) : Object

Gets default value of the specified tile. If no specification has been entered, it returns the default value.

isCompSpecified ( int c ) : bool

Whether or not specifications have been entered for the given component.

isTileCompSpecified ( int t, int c ) : bool

Whether or not a tile-component specification has been defined

isTileSpecified ( int t ) : bool

Whether or not specifications have been entered for the given tile.

parseIdx ( System word, int maxIdx ) : bool[]

This method is responsible of parsing tile indexes set and component indexes set for an option. Such an argument must follow the following policy:
t<indexes set> or c<indexes set> where tile or component indexes are separated by commas or a dashes.

Example:

  • t0,3,4 means tiles with indexes 0, 3 and 4.
  • t2-4 means tiles with indexes 2,3 and 4.
    It returns a boolean array skteching which tile or component are concerned by the next parameters.

  • rotate90 ( Coord anT ) : void

    Rotate the ModuleSpec instance by 90 degrees (this modifies only tile and tile-component specifications).

    setCompDef ( int c, System value_Renamed ) : void

    Sets default value for specified component and specValType tag if allowed by its priority.

    setDefault ( System value_Renamed ) : void

    Sets default value for this module

    setTileCompVal ( int t, int c, System value_Renamed ) : void

    Sets value for specified tile-component.

    setTileDef ( int t, System value_Renamed ) : void

    Sets default value for specified tile and specValType tag if allowed by its priority.

    Protected Methods

    Method Description
    getSpec ( int t, int c ) : Object

    Gets value of specified tile-component without knowing if a specific tile-component value has been previously entered. It first check if a tile-component specific value has been entered, then if a tile specific value exist, then if a component specific value exist. If not the default value is returned.

    Method Details

    Clone() public method

    public Clone ( ) : Object
    return System.Object

    ModuleSpec() public method

    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.
    public ModuleSpec ( int nt, int nc, byte type ) : System
    nt int The number of tiles /// ///
    nc int The number of components /// ///
    type byte the type of the specification module i.e. tile specific, /// component specific or both. /// ///
    return System

    getCompDef() public method

    Gets default value of the specified component. If no specification have been entered for this component, returns default value.
    public getCompDef ( int c ) : Object
    c int Component index /// ///
    return System.Object

    getDefault() public method

    Gets default value for this module.
    public getDefault ( ) : Object
    return System.Object

    getSpec() protected method

    Gets value of specified tile-component without knowing if a specific tile-component value has been previously entered. It first check if a tile-component specific value has been entered, then if a tile specific value exist, then if a component specific value exist. If not the default value is returned.
    protected getSpec ( int t, int c ) : Object
    t int Tile index /// ///
    c int Component index /// ///
    return System.Object

    getSpecValType() public method

    Return the spec type of the given tile-component.
    public getSpecValType ( int t, int c ) : byte
    t int Tile index /// ///
    c int Component index /// ///
    return byte

    getTileCompVal() public method

    Gets value of specified tile-component. This method calls getSpec but has a public access.
    public getTileCompVal ( int t, int c ) : Object
    t int Tile index /// ///
    c int Component index /// ///
    return System.Object

    getTileDef() public method

    Gets default value of the specified tile. If no specification has been entered, it returns the default value.
    public getTileDef ( int t ) : Object
    t int Tile index /// ///
    return System.Object

    isCompSpecified() public method

    Whether or not specifications have been entered for the given component.
    public isCompSpecified ( int c ) : bool
    c int Index of the component /// ///
    return bool

    isTileCompSpecified() public method

    Whether or not a tile-component specification has been defined
    public isTileCompSpecified ( int t, int c ) : bool
    t int Tile index /// ///
    c int Component index /// ///
    return bool

    isTileSpecified() public method

    Whether or not specifications have been entered for the given tile.
    public isTileSpecified ( int t ) : bool
    t int Index of the tile /// ///
    return bool

    parseIdx() public static method

    This method is responsible of parsing tile indexes set and component indexes set for an option. Such an argument must follow the following policy:
    t<indexes set> or c<indexes set> where tile or component indexes are separated by commas or a dashes.

    Example:

  • t0,3,4 means tiles with indexes 0, 3 and 4.
  • t2-4 means tiles with indexes 2,3 and 4.
    It returns a boolean array skteching which tile or component are concerned by the next parameters.
  • public static parseIdx ( System word, int maxIdx ) : bool[]
    word System The word to parse. /// ///
    maxIdx int Maximum authorized index /// ///
    return bool[]

    rotate90() public method

    Rotate the ModuleSpec instance by 90 degrees (this modifies only tile and tile-component specifications).
    public rotate90 ( Coord anT ) : void
    anT Coord
    return void

    setCompDef() public method

    Sets default value for specified component and specValType tag if allowed by its priority.
    public setCompDef ( int c, System value_Renamed ) : void
    c int Component index /// ///
    value_Renamed System
    return void

    setDefault() public method

    Sets default value for this module
    public setDefault ( System value_Renamed ) : void
    value_Renamed System
    return void

    setTileCompVal() public method

    Sets value for specified tile-component.
    public setTileCompVal ( int t, int c, System value_Renamed ) : void
    t int Tie index /// ///
    c int Component index /// ///
    value_Renamed System
    return void

    setTileDef() public method

    Sets default value for specified tile and specValType tag if allowed by its priority.
    public setTileDef ( int t, System value_Renamed ) : void
    t int
    value_Renamed System
    return void

    Property Details

    compDef protected property

    The default value for each component. Null if no component specific value is defined
    protected Object[],System compDef
    return System.Object[]

    def protected property

    Default value for each tile-component
    protected Object,System def
    return System.Object

    nComp protected property

    The number of components
    protected int nComp
    return int

    nTiles protected property

    The number of tiles
    protected int nTiles
    return int

    specType protected property

    The type of the specification module
    protected int specType
    return int

    specValType protected property

    The spec type for each tile-component. The first index is the tile index, the second is the component index.
    protected byte[][] specValType
    return byte[][]

    tileCompVal protected property

    The specific value for each tile-component. Value of tile 16 component 3 is accessible through the hash value "t16c3". Null if no tile-component specific value is defined
    protected System.Collections.Generic.Dictionary tileCompVal
    return System.Object>.System.Collections.Generic.Dictionary

    tileDef protected property

    The default value for each tile. Null if no tile specific value is defined
    protected Object[],System tileDef
    return System.Object[]