ilog.cpl.util
Class IlpDomain

java.lang.Object
  extended by ilog.cpl.util.IlpDomain

public class IlpDomain
extends Object

Container of domain values. Domains contain a list of values and a list of ranges. These are used to determine the validity of an attribute value.

Compatibility Note: In JViews 8.0, this class was moved from ilog.cpl.service to ilog.cpl.util.

Since:
JViews 8.0

Constructor Summary
IlpDomain(Class valueClass)
          Constructs an empty IlpDomain.
IlpDomain(Class valueClass, List values, List ranges)
          Constructs an IlpDomain.
 
Method Summary
 void addRange(IlpRange value)
          Adds a range entry to the range list of the domain.
 void addRange(Object minValue, Object maxValue)
          Adds a range entry to the range list of the domain.
 void addValue(Object value)
          Adds a value entry to the value list of the domain.
 boolean contains(Object value)
          Tests whether a given value is included in the domain.
 boolean equals(Object other)
          Tests IlpDomains for equality.
 List getRanges()
          Gets the current range list of the domain.
 List getSelectionValues(Class type)
          This method returns a representative list of possible values.
 List getValues()
          Gets the current value list of the domain.
 Class getValueType()
          Gets the current value type of the domain.
 int hashCode()
          Support for hashmap.
 String toString()
          Creates a string containing the domain.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IlpDomain

public IlpDomain(Class valueClass)
Constructs an empty IlpDomain.

Parameters:
valueClass - Java class of the values in the domain.

IlpDomain

public IlpDomain(Class valueClass,
                 List values,
                 List ranges)
Constructs an IlpDomain.

Parameters:
values - The list of domain values.
ranges - The list of domain ranges.
Method Detail

getRanges

public List getRanges()
Gets the current range list of the domain.


getValues

public List getValues()
Gets the current value list of the domain.


getValueType

public Class getValueType()
Gets the current value type of the domain.


addValue

public void addValue(Object value)
Adds a value entry to the value list of the domain.

Parameters:
value - The value to be set.

addRange

public void addRange(IlpRange value)
Adds a range entry to the range list of the domain.

Parameters:
value - The value to be set.

addRange

public void addRange(Object minValue,
                     Object maxValue)
Adds a range entry to the range list of the domain.

Parameters:
minValue - Minimum range value
maxValue - Maximum range value

contains

public boolean contains(Object value)
Tests whether a given value is included in the domain.

Parameters:
value - The value to be tested.
Returns:
true if the value is included in the domain.

getSelectionValues

public List getSelectionValues(Class type)
This method returns a representative list of possible values. Since ranges of floating point numbers are infinite, not enumerable, representative intermediate values are selected. For example, a range [250,1330] becomes {250, 400, 600, 800, 1000, 1200, 1330}.

Parameters:
type - Either Integer.class or Double.class.

equals

public boolean equals(Object other)
Tests IlpDomains for equality.

Overrides:
equals in class Object
Parameters:
other - Object to test for equality with.
Returns:
Returns true if the domains are the same, false otherwise.

hashCode

public int hashCode()
Support for hashmap.

Overrides:
hashCode in class Object

toString

public String toString()
Creates a string containing the domain.

Overrides:
toString in class Object


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.