com.latencybusters.lbm.sdm
Class LBMSDMRawDecimal

java.lang.Object
  extended by com.latencybusters.lbm.sdm.LBMSDM
      extended by com.latencybusters.lbm.sdm.LBMSDMRaw
          extended by com.latencybusters.lbm.sdm.LBMSDMRawDecimal
All Implemented Interfaces:
java.lang.Cloneable

public class LBMSDMRawDecimal
extends LBMSDMRaw
implements java.lang.Cloneable

An LBMSDMRawDecimal is a helper class to minimise the effort of formatting and parsing Decimals


Field Summary
static int length
          The number of bytes needed to store a raw LBMSDMRawDecimal
 
Fields inherited from class com.latencybusters.lbm.sdm.LBMSDM
DEBUG_BASIC, debug_level, DEBUG_VERBOSE_PARSING
 
Constructor Summary
LBMSDMRawDecimal()
          Create a raw decimal object defaulting to 0e0
LBMSDMRawDecimal(long mant_upper, int e)
          Create a raw decimal providing the mantissa and exponent
LBMSDMRawDecimal(java.lang.String s)
          Create a raw decimal from a string
 
Method Summary
 LBMSDMRawDecimal clone()
          Get a copy of a raw decimal
 int exponent()
          Get the exponent of the decimal number
 int format(byte[] buf, int offset)
          Format into a byte buffer this field.
 long mantissa()
          Get the mantissa of the decimal number
 int parse(byte[] buf, int offset)
          Parse a byte buffer containing a raw decimal field (as received on a socket) The byte buffer must be in network order
 java.lang.String toString()
          Create a string representing a raw decimal
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDMRaw
toDbgString
 
Methods inherited from class com.latencybusters.lbm.sdm.LBMSDM
log, set_debug_level
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

length

public static int length
The number of bytes needed to store a raw LBMSDMRawDecimal

Constructor Detail

LBMSDMRawDecimal

public LBMSDMRawDecimal()
Create a raw decimal object defaulting to 0e0


LBMSDMRawDecimal

public LBMSDMRawDecimal(long mant_upper,
                        int e)
Create a raw decimal providing the mantissa and exponent

Parameters:
mant_upper - The mantissa
e - The exponent

LBMSDMRawDecimal

public LBMSDMRawDecimal(java.lang.String s)
                 throws LBMSDMException
Create a raw decimal from a string

Parameters:
s - The string formatted "MMMeEE" or "mmmEee"
Throws:
LBMSDMException
Method Detail

toString

public java.lang.String toString()
Create a string representing a raw decimal

Overrides:
toString in class java.lang.Object
Returns:
A string in the format "MMMeEE"

format

public int format(byte[] buf,
                  int offset)
           throws LBMSDMException
Format into a byte buffer this field.

Parameters:
buf - The buffer to format the message in to
offset - The offset in to the byte buffer where the message should be placed
Returns:
The new offset in the buffer after formatting the message name
Throws:
LBMSDMException - when an unexpected error occurs within LBMSDM

parse

public int parse(byte[] buf,
                 int offset)
          throws LBMSDMException
Parse a byte buffer containing a raw decimal field (as received on a socket) The byte buffer must be in network order

Parameters:
buf - The byte array (buffer) containing the raw decimal to be parsed
offset - The index in the array where parsing should start
Returns:
the new offset after parsing the field
Throws:
LBMSDMException - if a problem occurs parsing the message buffer, for example if the message has bad data

clone

public LBMSDMRawDecimal clone()
                       throws java.lang.CloneNotSupportedException
Get a copy of a raw decimal

Overrides:
clone in class java.lang.Object
Returns:
A raw decimal object LBMSDMRawDecimal
Throws:
java.lang.CloneNotSupportedException

mantissa

public long mantissa()
Get the mantissa of the decimal number

Returns:
The mantissa of the decimal number

exponent

public int exponent()
Get the exponent of the decimal number

Returns:
The exponent of the decimal number


All of the documentation and software included in this and any other Informatica Inc "Ultra Messaging" Release is Copyright (C) 2004-2014, Informatica Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted only as covered by the terms of a valid software license agreement with 29West Inc. Copyright © 2004-2014, Informatica, Inc. All Rights Reserved.