HOME

com.ireasoning.protocol.snmp
Class SnmpCounter64

java.lang.Object
  |
  +--com.ireasoning.protocol.snmp.SnmpCounter64
All Implemented Interfaces:
Msg, Serializable, SnmpDataType

public class SnmpCounter64
extends Object
implements SnmpDataType

This class represents snmp Counter64 type. The Counter64 type represents a non-negative integer which monotonically increases until it reaches a maximum value of 2^64-1 (18446744073709551615 decimal), when it wraps around and starts increasing again from zero.

See Also:
Serialized Form

Field Summary
static SnmpCounter64 MAX_VALUE
          A constant holding the maximum value a SnmpCounter64 can have
 
Fields inherited from interface com.ireasoning.protocol.snmp.SnmpDataType
BITS, BITSTRING, COUNTER32, COUNTER64, END_OF_MIB_VIEW, END_OF_MIB_VIEW_OBJECT, GAUGE32, INTEGER, IPADDRESS, NO_SUCH_INSTANCE, NO_SUCH_INSTANCE_OBJECT, NO_SUCH_OBJECT, NO_SUCH_OBJECT_OBJECT, NULL, OCTETSTRING, OID, OPAQUE, PDU, SEQUENCE, SEQUENCEOF, TIMETICKS, UNSIGNED32, VARBIND
 
Fields inherited from interface com.ireasoning.protocol.Msg
ERROR_TYPE
 
Constructor Summary
SnmpCounter64()
          Constructs a new SnmpCounter64 object
SnmpCounter64(BigInteger l)
          Constructs a SnmpCounter64 object with the passed value.
SnmpCounter64(long l)
          Constructs a SnmpCounter64 object with the passed long value.
SnmpCounter64(SnmpCounter64 count64)
          Constructs a SnmpCounter64 object which is a copy of passed in object
SnmpCounter64(String i)
          Constructs a SnmpCounter64 object with the passed String value.
 
Method Summary
 SnmpDataType copy()
          Makes a copy of itself
 int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
          For internal use
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 int getType()
          Returns SnmpDataType.COUNTER64
 String getTypeString()
          Returns "Counter64"
 BigInteger getValue()
          Returns the value as BigInteger data type of this object
 int hashCode()
          Returns a hash code value for the object
 void inc()
          Increments counter value by 1, wrap around if it reaches max.
 void inc(long val)
          Increments Counter64 value by passed val
 void setValue(BigInteger value)
          Sets a new value
 void setValue(long l)
          Sets a new value
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VALUE

public static final SnmpCounter64 MAX_VALUE
A constant holding the maximum value a SnmpCounter64 can have
Constructor Detail

SnmpCounter64

public SnmpCounter64()
Constructs a new SnmpCounter64 object

SnmpCounter64

public SnmpCounter64(long l)
Constructs a SnmpCounter64 object with the passed long value.
Throws:
IllegalArgumentException - raised if passed value is negative

SnmpCounter64

public SnmpCounter64(BigInteger l)
Constructs a SnmpCounter64 object with the passed value.
Throws:
IllegalArgumentException - raised if passed value is negative or too big

SnmpCounter64

public SnmpCounter64(String i)
Constructs a SnmpCounter64 object with the passed String value.
Throws:
IllegalArgumentException - raised if passed value is negative

SnmpCounter64

public SnmpCounter64(SnmpCounter64 count64)
Constructs a SnmpCounter64 object which is a copy of passed in object
Method Detail

getValue

public BigInteger getValue()
Returns the value as BigInteger data type of this object

inc

public void inc(long val)
Increments Counter64 value by passed val
Throws:
UnsupportedOperationException - if called for SnmpCounter64.MAX_VALUE

inc

public void inc()
Increments counter value by 1, wrap around if it reaches max.
Throws:
UnsupportedOperationException - if called for SnmpCounter64.MAX_VALUE

setValue

public void setValue(long l)
Sets a new value
Parameters:
l - a new long value
Throws:
UnsupportedOperationException - if called for SnmpCounter64.MAX_VALUE

setValue

public void setValue(BigInteger value)
Sets a new value
Throws:
UnsupportedOperationException - if called for SnmpCounter64.MAX_VALUE

toString

public String toString()
Overrides:
toString in class Object

getType

public int getType()
Returns SnmpDataType.COUNTER64
Specified by:
getType in interface SnmpDataType
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
the object data type

getTypeString

public String getTypeString()
Returns "Counter64"
Specified by:
getTypeString in interface SnmpDataType

copy

public SnmpDataType copy()
Description copied from interface: SnmpDataType
Makes a copy of itself
Specified by:
copy in interface SnmpDataType
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
a deep copy of this object

encode

public int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
           throws SnmpEncodingException
Description copied from interface: SnmpDataType
For internal use
Specified by:
encode in interface SnmpDataType

equals

public boolean equals(Object obj)
Description copied from interface: SnmpDataType
Indicates whether some other object is "equal to" this one.
Specified by:
equals in interface SnmpDataType
Overrides:
equals in class Object
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
true if this object is the same as the obj argument; false otherwise

hashCode

public int hashCode()
Description copied from interface: SnmpDataType
Returns a hash code value for the object
Specified by:
hashCode in interface SnmpDataType
Overrides:
hashCode in class Object
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
a hash code value for the object

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.