javax.media.jai.remote
Interface Negotiable

All Superinterfaces:
Serializable
All Known Implementing Classes:
NegotiableCollection, NegotiableNumeric, NegotiableNumericRange

public interface Negotiable
extends Serializable

An interface that defines objects that can be negotiated upon. Negotiation amongst objects is performed using the negotiate() method. This method can be used to perform a chaining of successful negotiations, i.e., the results of one successful negotiation can be used to negotiate with another Negotiable and so on. In order to retrieve a single negotiated value out of the Negotiable, the getNegotiatedValue() method can be used at any point during this series of negotiations.

Since:
JAI 1.1

Method Summary
 Object getNegotiatedValue()
          Returns a value that is valid for this Negotiable.
 Class getNegotiatedValueClass()
          Returns the Class of the object that would be returned from the getNegotiatedValue method on a successful negotiation.
 Negotiable negotiate(Negotiable other)
          Returns a Negotiable object that represents the set intersection of this Negotiable with the given Negotiable.
 

Method Detail

negotiate

public Negotiable negotiate(Negotiable other)
Returns a Negotiable object that represents the set intersection of this Negotiable with the given Negotiable. The returned Negotiable represents the support that is common to both the Negotiables. If the negotiation fails, i.e there is no common subset, null is returned.

If the supplied argument is null, negotiation will fail and null will be returned, as it is not possible to negotiate with a null value. It may, however, be noted that it is valid for getNegotiatedValue() to return null, i.e the single value result of the negotiation can be null.

Parameters:
other - The Negotiable object to negotiate with.

getNegotiatedValue

public Object getNegotiatedValue()
Returns a value that is valid for this Negotiable. If more than one value is valid for this Negotiable, this method can choose one arbitrarily, e.g. picking the first one or by having static preferences amongst the valid values. Which of the many valid values is returned is upto the particular implementation of this method.


getNegotiatedValueClass

public Class getNegotiatedValueClass()
Returns the Class of the object that would be returned from the getNegotiatedValue method on a successful negotiation. This method can be used to learn what the Class of the negotiated value will be if the negotiation is successful. Implementing classes are encouraged to return an accurate Class from this method if at all possible. However it is permissible to return null, if the Class of the negotiated value is indeterminate for any reason.