jenes.chromosome
Class BitwiseChromosome.BitCoding<T>

java.lang.Object
  extended by jenes.chromosome.BitwiseChromosome.BitCoding<T>
Type Parameters:
T - The type entailed by enconding/deconding operations.
Direct Known Subclasses:
BooleanCoding, ByteCoding, GrayCoding, IntCoding, ShortCoding, WordCoding
Enclosing class:
BitwiseChromosome

public abstract static class BitwiseChromosome.BitCoding<T>
extends java.lang.Object

Represents the coding used by a BitwiseChromosome. A BitCoding can be used by subclassing this class and providing implementation for encode(Object) and decode(int) methods. A BitwiseChromosome.BitSize object is useful to specify the number of bits to use foreach coded number.

Since:
1.0
Version:
1.2
Author:
Luigi Troiano, Pierpaolo Lombardi, Giuseppe Pascale, Thierry Bodhuin

Field Summary
 BitwiseChromosome.BitSize SIZE
          The bit structure characteristics.
 
Constructor Summary
protected BitwiseChromosome.BitCoding(BitwiseChromosome.BitSize size)
          Constructs a new BitCoding with the specified BitwiseChromosome.BitSize
 
Method Summary
abstract  T decode(int bits)
          Returns the value of coded bits.
abstract  int encode(T obj)
          Returns the bits coding the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZE

public final BitwiseChromosome.BitSize SIZE
The bit structure characteristics.

Constructor Detail

BitwiseChromosome.BitCoding

protected BitwiseChromosome.BitCoding(BitwiseChromosome.BitSize size)
Constructs a new BitCoding with the specified BitwiseChromosome.BitSize

Parameters:
size - the bitSize object to use
Method Detail

decode

public abstract T decode(int bits)
Returns the value of coded bits.

Parameters:
bits - coding the object
Returns:
the value

encode

public abstract int encode(T obj)
Returns the bits coding the object

Parameters:
obj - the object to be coded
Returns:
the coding bits