org.opcfoundation.ua.builtintypes
Class UnsignedShort

java.lang.Object
  extended by java.lang.Number
      extended by org.opcfoundation.ua.builtintypes.UnsignedShort
All Implemented Interfaces:
Serializable, Comparable<UnsignedShort>

public final class UnsignedShort
extends Number
implements Comparable<UnsignedShort>

Unsigned Short represents an integer number value between 0 .. and 0xFFFF.

There is a static instance for values between 0..1023 which can be accessed using static methods valueOf(int) or getFromBits(short)

This class is immutable.

To create UnsignedShort from an integer value use toShortBits() and getFromBits(short).

See Also:
Serialized Form

Field Summary
static NodeId ID
          Constant ID
static long L_MAX_VALUE
          Constant L_MAX_VALUE=0xFFFFL
static long L_MIN_VALUE
          Constant L_MIN_VALUE=0L
static UnsignedShort MAX_VALUE
          Constant MAX_VALUE
static UnsignedShort MIN_VALUE
          Constant MIN_VALUE
static UnsignedShort ONE
          Constant ONE
static UnsignedShort ZERO
          Constant ZERO
 
Constructor Summary
UnsignedShort()
          Constructor for UnsignedShort.
UnsignedShort(int value)
          Constructor for UnsignedShort.
UnsignedShort(Number value)
          Constructor for UnsignedShort.
UnsignedShort(short value)
          Constructor for UnsignedShort.
UnsignedShort(String value)
          Constructor for UnsignedShort.
 
Method Summary
 UnsignedShort add(int increment)
          Add a value.
 UnsignedShort add(UnsignedShort increment)
          Add a value.
 byte byteValue()
          
 int compareTo(UnsignedShort o)
          compareTo.
 UnsignedShort dec()
          Decrease the value by one.
 double doubleValue()
          
 boolean equals(Object obj)
          
 float floatValue()
          
static UnsignedShort getFromBits(short value)
          getFromBits.
 int getValue()
          Getter for the field value.
 int hashCode()
          
 UnsignedShort inc()
          Increase the value by one.
 int intValue()
          
 long longValue()
          
static UnsignedShort max(UnsignedShort v0, UnsignedShort v1)
          max.
static UnsignedShort min(UnsignedShort v0, UnsignedShort v1)
          min.
static UnsignedShort parseUnsignedShort(String s)
          Parse an UnsignedShort value from a string
static UnsignedShort parseUnsignedShort(String s, int radix)
          Parses the string argument as an unsigned byte similar to Integer.parseInt(String, int)
 short shortValue()
          
 UnsignedShort subtract(int decrement)
          Subtract a value from this value.
 UnsignedShort subtract(UnsignedShort decrement)
          Subtract a value from this value.
 short toShortBits()
          toShortBits.
 String toString()
          
static UnsignedShort valueOf(int value)
          valueOf.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final NodeId ID
Constant ID


L_MAX_VALUE

public static final long L_MAX_VALUE
Constant L_MAX_VALUE=0xFFFFL

See Also:
Constant Field Values

L_MIN_VALUE

public static final long L_MIN_VALUE
Constant L_MIN_VALUE=0L

See Also:
Constant Field Values

MAX_VALUE

public static final UnsignedShort MAX_VALUE
Constant MAX_VALUE


MIN_VALUE

public static final UnsignedShort MIN_VALUE
Constant MIN_VALUE


ZERO

public static final UnsignedShort ZERO
Constant ZERO


ONE

public static final UnsignedShort ONE
Constant ONE

Constructor Detail

UnsignedShort

public UnsignedShort()

Constructor for UnsignedShort.


UnsignedShort

public UnsignedShort(short value)

Constructor for UnsignedShort.

Parameters:
value - a short.

UnsignedShort

public UnsignedShort(int value)
              throws IllegalArgumentException

Constructor for UnsignedShort.

Parameters:
value - a int.
Throws:
IllegalArgumentException - if any.

UnsignedShort

public UnsignedShort(String value)
              throws IllegalArgumentException

Constructor for UnsignedShort.

Parameters:
value - a String object.
Throws:
IllegalArgumentException - if any.

UnsignedShort

public UnsignedShort(Number value)

Constructor for UnsignedShort.

Parameters:
value - a Number object.
Method Detail

max

public static UnsignedShort max(UnsignedShort v0,
                                UnsignedShort v1)

max.

Parameters:
v0 - a UnsignedShort object.
v1 - a UnsignedShort object.
Returns:
a UnsignedShort object.

min

public static UnsignedShort min(UnsignedShort v0,
                                UnsignedShort v1)

min.

Parameters:
v0 - a UnsignedShort object.
v1 - a UnsignedShort object.
Returns:
a UnsignedShort object.

getFromBits

public static UnsignedShort getFromBits(short value)

getFromBits.

Parameters:
value - a short.
Returns:
a UnsignedShort object.

valueOf

public static UnsignedShort valueOf(int value)

valueOf.

Parameters:
value - a int.
Returns:
a UnsignedShort object.

getValue

public int getValue()

Getter for the field value.

Returns:
a int.

doubleValue

public double doubleValue()

Specified by:
doubleValue in class Number

floatValue

public float floatValue()

Specified by:
floatValue in class Number

intValue

public int intValue()

Specified by:
intValue in class Number

longValue

public long longValue()

Specified by:
longValue in class Number

shortValue

public short shortValue()

Overrides:
shortValue in class Number

byteValue

public byte byteValue()

Overrides:
byteValue in class Number

compareTo

public int compareTo(UnsignedShort o)

compareTo.

Specified by:
compareTo in interface Comparable<UnsignedShort>
Parameters:
o - a UnsignedShort object.
Returns:
a int.

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

toShortBits

public short toShortBits()

toShortBits.

Returns:
a short.

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

inc

public UnsignedShort inc()
Increase the value by one. Note that this object is not changed, but a new one is created.

Returns:
a new UnsignedShort, increased by 1 from this one.

dec

public UnsignedShort dec()
Decrease the value by one. Note that this object is not changed, but a new one is created.

Returns:
a new UnsignedShort, decreased by 1 from this one.
Throws:
IllegalArgumentException - if the value was 0 before the call

add

public UnsignedShort add(int increment)
Add a value. Note that this object is not changed, but a new one is created.

Parameters:
increment - the value to add to the current value
Returns:
a new UnsignedShort, increased by increment from this one.

add

public UnsignedShort add(UnsignedShort increment)
Add a value. Note that this object is not changed, but a new one is created.

Parameters:
increment - the value to add to the current value
Returns:
a new UnsignedShort, increased by increment from this one.

subtract

public UnsignedShort subtract(int decrement)
Subtract a value from this value. Note that this object is not changed, but a new one is created.

Parameters:
decrement - the value to subtract from the current value
Returns:
a new UnsignedShort, decreased by decrement from this one.
Throws:
IllegalArgumentException - if the decrement is bigger than the current value

subtract

public UnsignedShort subtract(UnsignedShort decrement)
Subtract a value from this value. Note that this object is not changed, but a new one is created.

Parameters:
decrement - the value to subtract from the current value
Returns:
a new UnsignedShort, decreased by decrement from this one.
Throws:
IllegalArgumentException - if the decrement is bigger than the current value

parseUnsignedShort

public static UnsignedShort parseUnsignedShort(String s)
                                        throws NumberFormatException,
                                               IllegalArgumentException
Parse an UnsignedShort value from a string

Parameters:
s - the string to parse, assumed to contain a positive Integer value
Returns:
the respective UnsignedShort
Throws:
NumberFormatException - if the string cannot be parsed into an integer value
IllegalArgumentException - if the parsed value does not fit in the range of UnsignedShort

parseUnsignedShort

public static UnsignedShort parseUnsignedShort(String s,
                                               int radix)
                                        throws NumberFormatException,
                                               IllegalArgumentException
Parses the string argument as an unsigned byte similar to Integer.parseInt(String, int)

Parameters:
s - the string to parse, assumed to contain a positive Integer value
radix - the radix to be used while parsing s.
Returns:
the respective UnsignedShort
Throws:
NumberFormatException - if the string cannot be parsed into an integer value
IllegalArgumentException - if the parsed value does not fit in the range of UnsignedShort


Copyright © 2018. All rights reserved.