com.jniwrapper
Class Int

java.lang.Object
  |
  +--com.jniwrapper.Parameter
        |
        +--com.jniwrapper.DelegatingParameter
              |
              +--com.jniwrapper.PlatformInteger
                    |
                    +--com.jniwrapper.Int
All Implemented Interfaces:
IntegerParameter
Direct Known Subclasses:
Enumeration, EnumParameter

public class Int
extends com.jniwrapper.PlatformInteger

C-like int value.


Constructor Summary
Int()
          Constructs a new int parameter.
Int(IntegerParameter t)
          Constructs a new int parameter with the same value as in passed object.
Int(long val)
          Constructs a new int parameter.
 
Method Summary
protected  void acceptIOPerformer(IOPerformer performer, DataBuffer source, int initialOffset, boolean isReadOperation, boolean invokedByCallback)
          Realization of a Visitor pattern for parameter IO.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
          Compares this Parameter object to a given object.
protected  DataBuffer getDataBuffer()
          Returns current data storage.
protected  int getDataBufferOffset()
          Returns current offset within data storage.
 int getLength()
          Returns a length of the parameter in memory.
 long getValue()
          Returns integer value converted to long
 void pop(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Default implementation, which does nothing as most primitive types do nothing on pop.
 void push(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Writes a parameter to a function stacks
 void read(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Reads this parameter from a specified data source.
protected  void setDataBuffer(DataBuffer newSource, int newOffset)
          Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer.
 void setValue(long val)
          Sets integer value
 java.lang.Long toLong()
           
 java.lang.String toString()
           
 void write(DataBuffer stackBuffer, int offset, boolean invokedByCallback)
          Writes this parameter to a specified data source.
 
Methods inherited from class com.jniwrapper.Parameter
asReturnValue, getAlignedLength, getAlignmentRequirement, indent, read, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Int

public Int()
Constructs a new int parameter.


Int

public Int(long val)
Constructs a new int parameter.

Parameters:
val - initial value.

Int

public Int(IntegerParameter t)
Constructs a new int parameter with the same value as in passed object.

Parameters:
t - parameter to take initial value from.
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in class com.jniwrapper.PlatformInteger

getValue

public long getValue()
Description copied from interface: IntegerParameter
Returns integer value converted to long

Specified by:
getValue in interface IntegerParameter

setValue

public void setValue(long val)
Description copied from interface: IntegerParameter
Sets integer value

Specified by:
setValue in interface IntegerParameter

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Parameter
Compares this Parameter object to a given object. Two Parameter objects are considered equal if their byte representations are equal and they are of the same type. Subclasses may override this method as appropriate.

Overrides:
equals in class Parameter
Parameters:
obj - value to compare this object to
Returns:
true if two objects are equal.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toLong

public java.lang.Long toLong()

acceptIOPerformer

protected void acceptIOPerformer(IOPerformer performer,
                                 DataBuffer source,
                                 int initialOffset,
                                 boolean isReadOperation,
                                 boolean invokedByCallback)
Description copied from class: Parameter
Realization of a Visitor pattern for parameter IO. A performer is responsible for I/Oing the parameter. Users implementing a complex parameter from scratch (i.e. not by extending a pre-existing class such as Structure or Pointer) may wish to override this method to make a performer visit object internal parts.

Overrides:
acceptIOPerformer in class Parameter
Parameters:
performer - visitor responsible for I/Oing the parameter
source - data buffer for I/O operation
initialOffset - I/O operation offset of this parameter in the buffer

setDataBuffer

protected void setDataBuffer(DataBuffer newSource,
                             int newOffset)
Description copied from class: Parameter
Sets the data buffer this parameter should use to store data and an offset in bytes within that buffer.

Overrides:
setDataBuffer in class Parameter

getDataBuffer

protected DataBuffer getDataBuffer()
Description copied from class: Parameter
Returns current data storage.

Overrides:
getDataBuffer in class Parameter

getDataBufferOffset

protected int getDataBufferOffset()
Description copied from class: Parameter
Returns current offset within data storage.

Overrides:
getDataBufferOffset in class Parameter

getLength

public int getLength()
Description copied from class: Parameter
Returns a length of the parameter in memory. This method is analogous to C sizeof() operator.

Specified by:
getLength in class Parameter

write

public void write(DataBuffer stackBuffer,
                  int offset,
                  boolean invokedByCallback)
           throws MemoryAccessViolationException
Description copied from class: Parameter
Writes this parameter to a specified data source.

Specified by:
write in class Parameter
MemoryAccessViolationException

read

public void read(DataBuffer stackBuffer,
                 int offset,
                 boolean invokedByCallback)
          throws MemoryAccessViolationException
Description copied from class: Parameter
Reads this parameter from a specified data source.

Specified by:
read in class Parameter
MemoryAccessViolationException

push

public void push(DataBuffer stackBuffer,
                 int offset,
                 boolean invokedByCallback)
          throws MemoryAccessViolationException
Description copied from class: Parameter
Writes a parameter to a function stacks

Overrides:
push in class Parameter
MemoryAccessViolationException

pop

public void pop(DataBuffer stackBuffer,
                int offset,
                boolean invokedByCallback)
         throws MemoryAccessViolationException
Description copied from class: Parameter
Default implementation, which does nothing as most primitive types do nothing on pop. Reads a parameter from a function stack.

Overrides:
pop in class Parameter
MemoryAccessViolationException