## javax.media.jai.remote
Class NegotiableNumeric

    java.lang.Object
      |
      +--javax.media.jai.remote.NegotiableNumeric

All Implemented Interfaces:
  Negotiable, java.io.Serializable

public class NegotiableNumeric
extends java.lang.Object
implements Negotiable

A class that wraps a numeric primitive data type or a subclass of `Number` to implement the `Negotiable` interface. `NegotiableNumeric` is a convenience class to specify a `Negotiable` value for a parameter which has a single valid numeric value.

Since:
  1.1
See Also:
  Serialized Form

Constructor Summary
`NegotiableNumeric(byte b)` Creates a `NegotiableNumeric` given a `byte`.
`NegotiableNumeric(double d)` Creates a `NegotiableNumeric` given a `double`.
`NegotiableNumeric(float f)` Creates a `NegotiableNumeric` given a `float`.
`NegotiableNumeric(int i)` Creates a `NegotiableNumeric` given an `int`.
`NegotiableNumeric(long l)` Creates a `NegotiableNumeric` given a `long`.
`NegotiableNumeric(java.lang.Number n)` Creates a `NegotiableNumeric` given a `Number`.
`NegotiableNumeric(short s)` Creates a `NegotiableNumeric` given a `short`.

Method Summary
`java.lang.Object` `getNegotiatedValue()` Returns the result of the negotiation as a `Number` subclass.
`byte` `getNegotiatedValueAsByte()` A convenience method to return the single negotiated value as a `byte`.
`double` `getNegotiatedValueAsDouble()` A convenience method to return the single negotiated value as a `double`.
`float` `getNegotiatedValueAsFloat()` A convenience method to return the single negotiated value as a `float`.
`int` `getNegotiatedValueAsInt()` A convenience method to return the single negotiated value as a `int`.
`long` `getNegotiatedValueAsLong()` A convenience method to return the single negotiated value as a `long`.
`short` `getNegotiatedValueAsShort()` A convenience method to return the single negotiated value as a `short`.
`java.lang.Class` `getNegotiatedValueClass()` Returns the `Class` of the negotiated value.
`java.lang.Number` `getNumber()` Returns the `Number` that is currently the valid value for this class.
`Negotiable` `negotiate(Negotiable other)` Returns a `NegotiableNumeric` that contains the value that is common to this `NegotiableNumeric` and the one supplied, i.e the `Number` encapsulated in both the `NegotiableNumeric` are equal.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NegotiableNumeric

    public NegotiableNumeric(byte b)

  Creates a `NegotiableNumeric` given a `byte`.
  Parameters:
    `b` - The `byte` to be wrapped to implement `Negotiable`.

### NegotiableNumeric

    public NegotiableNumeric(short s)

  Creates a `NegotiableNumeric` given a `short`.
  Parameters:
    `s` - The `short` to be wrapped to implement `Negotiable`.

### NegotiableNumeric

    public NegotiableNumeric(int i)

  Creates a `NegotiableNumeric` given an `int`.
  Parameters:
    `i` - The `int` to be wrapped to implement `Negotiable`.

### NegotiableNumeric

    public NegotiableNumeric(long l)

  Creates a `NegotiableNumeric` given a `long`.
  Parameters:
    `l` - The `long` to be wrapped to implement `Negotiable`.

### NegotiableNumeric

    public NegotiableNumeric(float f)

  Creates a `NegotiableNumeric` given a `float`.
  Parameters:
    `f` - The `float` to be wrapped to implement `Negotiable`.

### NegotiableNumeric

    public NegotiableNumeric(double d)

  Creates a `NegotiableNumeric` given a `double`.
  Parameters:
    `d` - The `double` to be wrapped to implement `Negotiable`.

### NegotiableNumeric

    public NegotiableNumeric(java.lang.Number n)

  Creates a `NegotiableNumeric` given a `Number`.
  Parameters:
    `n` - The `Number` to be wrapped to implement `Negotiable`.
  Throws:
    `java.lang.IllegalArgumentException` - if n is null.

Method Detail

### getNumber

    public java.lang.Number getNumber()

  Returns the `Number` that is currently the valid value for this class. A valid primitive data type value, such as int, will be returned as a member of the corresponding wrapper class, such as `Integer`.

### negotiate

    public Negotiable negotiate(Negotiable other)

  Returns a `NegotiableNumeric` that contains the value that is common to this `NegotiableNumeric` and the one supplied, i.e the `Number` encapsulated in both the `NegotiableNumeric` are equal. If the supplied `Negotiable` is not a `NegotiableNumeric` with its element being of the same `Class` as this class', or if there is no common value (i.e the values are not equal), the negotiation will fail and `null` will be returned.
  Specified by:
    `negotiate` in interface `Negotiable`
  Parameters:
    `other` - The `Negotiable` to negotiate with.

### getNegotiatedValue

    public java.lang.Object getNegotiatedValue()

  Returns the result of the negotiation as a `Number` subclass. Values belonging to a base type, such as `int`, will be returned as a member of the corresponding `Number` subclass, such as `Integer`.
  Specified by:
    `getNegotiatedValue` in interface `Negotiable`

### getNegotiatedValueClass

    public java.lang.Class getNegotiatedValueClass()

  Returns the `Class` of the negotiated value. Values belonging to a base type, such as `int`, will be returned as a member of the corresponding `Number` subclass, such as `Integer`. The `Class` returned similarly will be a `Number` subclass.
  Specified by:
    `getNegotiatedValueClass` in interface `Negotiable`

### getNegotiatedValueAsByte

    public byte getNegotiatedValueAsByte()

  A convenience method to return the single negotiated value as a `byte`.
  Throws:
    `ClassCastException` - if the value is of a different Class type.

### getNegotiatedValueAsShort

    public short getNegotiatedValueAsShort()

  A convenience method to return the single negotiated value as a `short`.
  Throws:
    `ClassCastException` - if the value is of a different Class type.

### getNegotiatedValueAsInt

    public int getNegotiatedValueAsInt()

  A convenience method to return the single negotiated value as a `int`.
  Throws:
    `ClassCastException` - if the value is of a different Class type.

### getNegotiatedValueAsLong

    public long getNegotiatedValueAsLong()

  A convenience method to return the single negotiated value as a `long`.
  Throws:
    `ClassCastException` - if the value is of a different Class type.

### getNegotiatedValueAsFloat

    public float getNegotiatedValueAsFloat()

  A convenience method to return the single negotiated value as a `float`.
  Throws:
    `ClassCastException` - if the value is of a different Class type.

### getNegotiatedValueAsDouble

    public double getNegotiatedValueAsDouble()

  A convenience method to return the single negotiated value as a `double`.
  Throws:
    `ClassCastException` - if the value is of a different Class type.