TPTP 4.5.0 Platform Project
Public API Specification

org.eclipse.hyades.collection.correlation
Class BaseCorrelatorDataImpl

java.lang.Object
  extended by org.eclipse.hyades.collection.correlation.BaseCorrelatorDataImpl
All Implemented Interfaces:
ICorrelatorData
Direct Known Subclasses:
TraceCorrelator

public class BaseCorrelatorDataImpl
extends java.lang.Object
implements ICorrelatorData

This is the base implementation of a correlator. Application writers should sub-class this class, and may override the methods of this class.


Constructor Summary
BaseCorrelatorDataImpl()
           
 
Method Summary
 long convertBytesToInteger(byte[] buffer, int offset)
          Converts the offset...offset + 4 bytes of the given buffer into an unsigned integer.
 void convertIntegerToBytes(long n, byte[] buffer, int offset)
          Converts an unsigned integer into 4 bytes, and saves them in the buffer.
 IApplication getApplication()
          Returns the application associated with this correlator where application-instance-specific data can be retrieved.
 long getApplicationCounter()
          Returns applicationCounter.
 long getOperationCounter()
          Returns operationCounter.
 void invalidate()
          Invalidates this correlator by resetting it to an initialized correlator.
 int readBinary(byte[] buffer, int offset, int length)
          Converts an array of bytes into a correlator.
 int readXML(java.lang.StringBuffer data, int offset, int length)
          Converts an XML fragment into a correlator.
 void setApplicationCounter(long n)
          Sets applicationCounter to n.
 void setOperationCounter(long n)
          Sets operationCounter to n.
 int writeBinary(byte[] buffer, int offset, int length)
          Converts this correlator into an array of bytes, and saves them in the buffer.
 java.lang.StringBuffer writeXML(java.lang.StringBuffer data)
          Converts this correlator into an XML fragment, and saves them in the string buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseCorrelatorDataImpl

public BaseCorrelatorDataImpl()
Method Detail

invalidate

public void invalidate()
Invalidates this correlator by resetting it to an initialized correlator.


setApplicationCounter

public void setApplicationCounter(long n)
Sets applicationCounter to n.

Parameters:
n - the new value of applicationCounter

getApplicationCounter

public long getApplicationCounter()
Returns applicationCounter.

Returns:
n the new value of applicationCounter

setOperationCounter

public void setOperationCounter(long n)
Sets operationCounter to n.

Parameters:
n - the new value of operationCounter

getOperationCounter

public long getOperationCounter()
Returns operationCounter.

Returns:
the current value of operationCounter.

convertBytesToInteger

public long convertBytesToInteger(byte[] buffer,
                                  int offset)
Converts the offset...offset + 4 bytes of the given buffer into an unsigned integer.

Parameters:
buffer - the buffer containing the integer
offset - the offset inside the buffer where the most significant byte of the integer is read
Returns:
the unsigned integer corresponding to the offset..offset + 4 bytes.

convertIntegerToBytes

public void convertIntegerToBytes(long n,
                                  byte[] buffer,
                                  int offset)
Converts an unsigned integer into 4 bytes, and saves them in the buffer.

Parameters:
n - an unsigned integer to be converted
buffer - the buffer to stored the integer
offset - the offset inside the buffer where the most significant byte of the integer is written

readBinary

public int readBinary(byte[] buffer,
                      int offset,
                      int length)
               throws InsufficientBufferLengthException
Description copied from interface: ICorrelatorData
Converts an array of bytes into a correlator.

Specified by:
readBinary in interface ICorrelatorData
Parameters:
buffer - the data buffer from which the correlation information is to be read
offset - the starting position to read the correltion data
length - the length (in bytes) of the entire buffer for the correlation data
Returns:
the index of the byte right after the last byte of the correlation data read.
Throws:
InsufficientBufferLengthException - If the buffer is not long enough for holding the correlation data
See Also:
ICorrelatorData.readBinary(byte[], int, int)

writeBinary

public int writeBinary(byte[] buffer,
                       int offset,
                       int length)
                throws InsufficientBufferLengthException
Description copied from interface: ICorrelatorData
Converts this correlator into an array of bytes, and saves them in the buffer.

Specified by:
writeBinary in interface ICorrelatorData
Parameters:
buffer - the data buffer to which the correlator bytes are to be written
offset - the starting position to write the correltion data
length - the length (in bytes) of the buffer for the correlation data
Returns:
the index of the byte right after the last byte of the correlator data written.
Throws:
InsufficientBufferLengthException - If the buffer is not long enough for holding the correlation data
See Also:
ICorrelatorData.writeBinary(byte[], int, int)

readXML

public int readXML(java.lang.StringBuffer data,
                   int offset,
                   int length)
Description copied from interface: ICorrelatorData
Converts an XML fragment into a correlator.

Specified by:
readXML in interface ICorrelatorData
Parameters:
data - the data buffer from which the correlation information is to be read
offset - the starting position to read the correltion data
length - the length (in characters) of the entire buffer for the correlation data
Returns:
the index of the character right after the last character of the correlation data read.
See Also:
ICorrelatorData.readXML(StringBuffer, int, int)

writeXML

public java.lang.StringBuffer writeXML(java.lang.StringBuffer data)
Description copied from interface: ICorrelatorData
Converts this correlator into an XML fragment, and saves them in the string buffer.

Specified by:
writeXML in interface ICorrelatorData
Parameters:
data - the data buffer to which the correlator information is to be written
Returns:
the string buffer with the information about this correlator attached at the end.
See Also:
ICorrelatorData.writeXML(StringBuffer)

getApplication

public IApplication getApplication()
Description copied from interface: ICorrelatorData
Returns the application associated with this correlator where application-instance-specific data can be retrieved.

Specified by:
getApplication in interface ICorrelatorData
Returns:
the application associated with this correlator.
See Also:
ICorrelatorData.getApplication()

TPTP 4.5.0 Platform Project
Public API Specification