jenes.chromosome.codings
Class BooleanCoding

java.lang.Object
  extended by jenes.chromosome.BitwiseChromosome.BitCoding<java.lang.Boolean>
      extended by jenes.chromosome.codings.BooleanCoding

public class BooleanCoding
extends BitwiseChromosome.BitCoding<java.lang.Boolean>

Represents a boolean coding with 1 bit representation. The value false is associated to 0, and true to 1.

Since:
1.2
Version:
1.2
Author:
Luigi Troiano
See Also:
ByteCoding, IntCoding, ShortCoding, WordCoding, BitwiseChromosome.BitSize

Field Summary
 
Fields inherited from class jenes.chromosome.BitwiseChromosome.BitCoding
SIZE
 
Constructor Summary
BooleanCoding()
          Default constructor
 
Method Summary
 java.lang.Boolean decode(int bits)
          Returns the value of coded bits.
 int encode(java.lang.Boolean obj)
          Returns the bits coding the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanCoding

public BooleanCoding()
Default constructor

Method Detail

decode

public java.lang.Boolean decode(int bits)
Returns the value of coded bits. If the argument is 1 it returns true, if 0 then false.

Specified by:
decode in class BitwiseChromosome.BitCoding<java.lang.Boolean>
Parameters:
bits - coding the object
Returns:
the value

encode

public int encode(java.lang.Boolean obj)
Returns the bits coding the value. It returns 0 if the argument is false, 1 if true.

Specified by:
encode in class BitwiseChromosome.BitCoding<java.lang.Boolean>
Parameters:
obj - the boolean value to be coded
Returns:
the coding bits