jef.dna.attributes.impl
Class ConstantValue

java.lang.Object
  extended by jef.dna.attributes.impl.GenericAttribute
      extended by jef.dna.attributes.impl.ConstantValue
All Implemented Interfaces:
java.lang.Cloneable, Attribute, ConstantValueAttribute, BytesCountable

public class ConstantValue
extends GenericAttribute
implements ConstantValueAttribute


Field Summary
protected static Logger logger
           
 
Fields inherited from class jef.dna.attributes.impl.GenericAttribute
attribFactory, attributeNameIndex, dna, instrFactory
 
Constructor Summary
ConstantValue()
          Constructor.
 
Method Summary
 java.lang.Object clone()
          The clone() method will return a new instance whose reference to the containing Dna instance is set to null.
 void fromStream(java.io.DataInputStream dis, Dna dna, int index, int length)
          This method reads the data with which the attribute has to be initialized.
 int getBytesCount()
          This method must return the overall number of bytes required by the component implementing this interface.
 int getValue()
          This method gets the constantvalue_index of the current ConstantValueAttribute.
protected  void innerValidations(ConstantPoolTable cpt)
           
 void setValue(int value)
          This method sets the constantvalue_index of the current ConstantValueAttribute.
 void toStream(java.io.DataOutputStream dos)
          This method writes the attribute to the provided output stream.
 void updateRefs(int offset)
          This method updates all the references pointing to constant pool table's entries this attributes holds.
 
Methods inherited from class jef.dna.attributes.impl.GenericAttribute
getDna, getLength, getNameIndex, setDna, setNameIndex, validate, validateNameIndex
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jef.dna.attributes.Attribute
getDna, getLength, getNameIndex, setDna, setNameIndex, validate
 

Field Detail

logger

protected static Logger logger
Constructor Detail

ConstantValue

public ConstantValue()
Constructor.

Method Detail

setValue

public void setValue(int value)
Description copied from interface: ConstantValueAttribute
This method sets the constantvalue_index of the current ConstantValueAttribute. The provided index has to be a valid index into the constant pool table. The entry at that index gives the constant value represented by this attribute.

Specified by:
setValue in interface ConstantValueAttribute
Parameters:
constantValueIndex -

getValue

public int getValue()
Description copied from interface: ConstantValueAttribute
This method gets the constantvalue_index of the current ConstantValueAttribute. This index will be a valid index into the constant pool table. The entry at that index gives the constant value represented by this attribute.

Specified by:
getValue in interface ConstantValueAttribute
Returns:
int

toStream

public void toStream(java.io.DataOutputStream dos)
              throws DnaSerializationException
Description copied from interface: Attribute
This method writes the attribute to the provided output stream.

Specified by:
toStream in interface Attribute
Parameters:
dos -
Throws:
DnaSerializationException

fromStream

public void fromStream(java.io.DataInputStream dis,
                       Dna dna,
                       int index,
                       int length)
                throws DnaDeserializationException,
                       MissingDnaContainerException
Description copied from interface: Attribute
This method reads the data with which the attribute has to be initialized.

Specified by:
fromStream in interface Attribute
Parameters:
dis -
dna -
index -
length -
Throws:
DnaDeserializationException
MissingDnaContainerException

updateRefs

public void updateRefs(int offset)
Description copied from interface: Attribute
This method updates all the references pointing to constant pool table's entries this attributes holds.

Specified by:
updateRefs in interface Attribute
Specified by:
updateRefs in class GenericAttribute
Parameters:
offset -

innerValidations

protected void innerValidations(ConstantPoolTable cpt)
                         throws AttributeValidationException,
                                AttributeOutOfRangeException,
                                MissingDnaContainerException,
                                MissingCPTableException
Overrides:
innerValidations in class GenericAttribute
Parameters:
cpt -
Throws:
AttributeValidationException
AttributeOutOfRangeException
MissingDnaContainerException
MissingCPTableException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
The clone() method will return a new instance whose reference to the containing Dna instance is set to null. It is up to you appropriately setting it to the correct constantValueIndex.

Specified by:
clone in interface Attribute
Overrides:
clone in class GenericAttribute
Throws:
java.lang.CloneNotSupportedException

getBytesCount

public int getBytesCount()
Description copied from interface: BytesCountable
This method must return the overall number of bytes required by the component implementing this interface.

Specified by:
getBytesCount in interface BytesCountable