fulmine.model.field
Class IntegerField

java.lang.Object
  extended by fulmine.AbstractLifeCycle
      extended by fulmine.model.component.AbstractComponent
          extended by fulmine.model.field.AbstractField
              extended by fulmine.model.field.IntegerField
All Implemented Interfaces:
IEvent, IEventSource, IAddressable, IDescriptor, IDestroyable, ILifeCycle, IComponent, IField, IWireState, Cloneable

public final class IntegerField
extends AbstractField

Field implementation for an integer value.

Author:
Ramon Servadei

Constructor Summary
IntegerField(String identity)
           
IntegerField(String identity, byte application, short permission)
           
IntegerField(String identity, int value)
          Construct the field with the value from the native type
IntegerField(String identity, String value)
          Construct the field with the value from a string representation of the native type
 
Method Summary
protected  boolean doReadState(IOperationScope scope, byte[] buffer, int start, int numberOfBytes)
          Update the component state from the wire format state in the buffer.
protected  boolean doWriteState(IOperationScope scope, IWireIdentity wireId, byte[][] headerBuffer, int[] headerBufferPosition, byte[][] dataBuffer, int[] dataBufferPosition, boolean completeState)
          Write the component state in its wire form to the buffer.
 boolean equals(Object obj)
           
 int get()
          Get the integer value of the field
protected  AsyncLog getLog()
          Get the log to use for the object hierarchy
 Object getValue()
          Get the field value
 String getValueAsString()
          Get the value of this field as a string.
 int hashCode()
           
 boolean set(int value)
          Set the integer value for the field.
 boolean setValueFromString(String value)
          Set the field value from the string.
 
Methods inherited from class fulmine.model.field.AbstractField
addedToContainer, doComponentDestroy, getApplication, getContainer, getPermission, notifyEvent, removedFromContainer, setApplication, setContainer, setPermission, toDetailedString, toIdentityString, toString
 
Methods inherited from class fulmine.model.component.AbstractComponent
addEvent, addListener, checkClone, clone, createIdentityString, doDestroy, doPostAddListener, doPostRemoveListener, doStart, getAddress, getAddressable, getDomain, getDrivingFrame, getEventSourceGroupId, getFrame, getIdentity, getIdentityString, getListeners, getSource, getTriggerEvent, getType, isClone, readState, removeListener, removeListeners, setDrivingFrame, setFrame, setTriggerEvent, writeState
 
Methods inherited from class fulmine.AbstractLifeCycle
checkActive, destroy, finalize, isActive, start
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fulmine.model.field.IField
clone
 
Methods inherited from interface fulmine.protocol.wire.IWireState
readState, writeState
 
Methods inherited from interface fulmine.event.IEventSource
addEvent, addListener, getEventSourceGroupId, getListeners, removeListener, removeListeners
 
Methods inherited from interface fulmine.ILifeCycle
isActive, start
 
Methods inherited from interface fulmine.IDestroyable
destroy
 
Methods inherited from interface fulmine.IAddressable
getAddress, getDomain, getIdentity, getType
 
Methods inherited from interface fulmine.event.IEvent
getDrivingFrame, getFrame, getSource, getTriggerEvent, setTriggerEvent
 
Methods inherited from interface fulmine.IAddressable
getAddress, getDomain, getIdentity, getType
 

Constructor Detail

IntegerField

public IntegerField(String identity)

IntegerField

public IntegerField(String identity,
                    byte application,
                    short permission)

IntegerField

public IntegerField(String identity,
                    int value)
Construct the field with the value from the native type

Parameters:
identity - the field identity
value - the native value for the field

IntegerField

public IntegerField(String identity,
                    String value)
Construct the field with the value from a string representation of the native type

Parameters:
identity - the field identity
value - the string representation of the value for the field
Method Detail

getLog

protected AsyncLog getLog()
Description copied from class: AbstractLifeCycle
Get the log to use for the object hierarchy

Overrides:
getLog in class AbstractComponent
Returns:
the log to use for the object hierarchy

get

public int get()
Get the integer value of the field

Returns:
the integer value of this field

set

public boolean set(int value)
Set the integer value for the field. If the field value changes, an event is generated.

Parameters:
value - the new integer value for this field
Returns:
true if the value of the field changed
See Also:
#notifyEvent(fulmine.model.event.IEvent)

doReadState

protected boolean doReadState(IOperationScope scope,
                              byte[] buffer,
                              int start,
                              int numberOfBytes)
                       throws Exception
Description copied from class: AbstractComponent
Update the component state from the wire format state in the buffer. Any nested fields must be read using their AbstractComponent.readState(IOperationScope, byte[], int, int) method.

Specified by:
doReadState in class AbstractComponent
Returns:
true if the read operation succeded.
Throws:
Exception
See Also:
IWireState.readState(IOperationScope, byte[], int, int)

doWriteState

protected boolean doWriteState(IOperationScope scope,
                               IWireIdentity wireId,
                               byte[][] headerBuffer,
                               int[] headerBufferPosition,
                               byte[][] dataBuffer,
                               int[] dataBufferPosition,
                               boolean completeState)
                        throws Exception
Description copied from class: AbstractComponent
Write the component state in its wire form to the buffer. Any nested fields must be written by calling their AbstractComponent.writeState(IOperationScope, IWireIdentity, byte[][], int[], byte[][], int[], boolean) method.

Specified by:
doWriteState in class AbstractComponent
Returns:
true if the write operation succeeded
Throws:
Exception
See Also:
IWireState.writeState(IOperationScope, IWireIdentity, byte[][], int[], byte[][], int[], boolean), for a discussion of the byte[][] usage

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractField

equals

public boolean equals(Object obj)
Overrides:
equals in class AbstractField

getValueAsString

public String getValueAsString()
Description copied from interface: IField
Get the value of this field as a string.

Returns:
a string representing the value of this field.

getValue

public Object getValue()
Description copied from interface: IField
Get the field value

Returns:
the field type

setValueFromString

public boolean setValueFromString(String value)
Description copied from interface: IField
Set the field value from the string. The field converts the string into the field's data format. If there is an error performing this, the operation simply returns false or throws a RuntimeException.

Specified by:
setValueFromString in interface IField
Overrides:
setValueFromString in class AbstractField
Parameters:
value - the value to set
Returns:
true if the value changed, false if it did not or there was a problem converting the string to the field's data format


Copyright © 2007-2009. All Rights Reserved.