Methods Summary |
---|
protected int | decValue(int index)
int original_value = getValue( index );
if ( original_value <= 0 ){
return( 0 );
}
setValue( index, (byte)(original_value-1));
return( original_value );
|
protected int | getValue(int index)
byte b = map[index/2];
if ( index % 2 == 0 ){
return(( b&0x0f ) & 0xff );
}else{
return(((b>>4)&0x0f) & 0xff );
}
|
protected int | incValue(int index)
int original_value = getValue( index );
if ( original_value >= 15 ){
return( 15 );
}
setValue( index, (byte)(original_value+1) );
return( original_value );
|
private void | setValue(int index, byte value)
byte b = map[index/2];
if ( index % 2 == 0 ){
b = (byte)((b&0xf0) | value );
}else{
b = (byte)((b&0x0f) | (value<<4)&0xf0 );
}
// System.out.println( "setValue[" + index + "]:" + Integer.toHexString( map[index/2]&0xff) + "->" + Integer.toHexString( b&0xff ));
map[index/2] = b;
|
protected int | trimValue(int value)
if ( value < 0 ){
return( 0 );
}else if ( value > 15 ){
return( 15 );
}else{
return( value );
}
|