FRAMES NO FRAMES

Class IloAnySet

Definition file: ilconcert/iloanyset.h
A class to represent a set of enumeration values.

An instance of this class represents a set of enumerated values. The same enumerated value will not appear more than once in a set. The elements of a set are not ordered. The class IloAnySet::Iterator offers you a way to traverse the elements of such a set.

If you are considering modeling issues where you want to represent repeated elements or where you want to exploit an indexed order among the elements, then you might want to look at the class IloAnyArray instead of this class for sets.

Most member functions in this class contain assert statements. For an explanation of the macro NDEBUG (a way to turn on or turn off these assert statements), see the concept Assert and NDEBUG.

See Also:

Constructor Summary
public IloAnySet(const IloEnv env, const IloAnyArray array, IloBool withIndex=IloFalse)
public IloAnySet(const IloEnv env, IloBool withIndex=IloFalse)
Method Summary
public voidadd(IloAnySet set)
public voidadd(IloAny elt)
public IloBoolcontains(IloAnySet set) const
public IloBoolcontains(IloAny elt) const
public IloAnySetcopy() const
public voidempty()
public IloAnygetNext(IloAny value, IloInt n=1) const
public IloAnygetNextC(IloAny value, IloInt n=1) const
public IloAnygetPrevious(IloAny value, IloInt n=1) const
public IloAnygetPreviousC(IloAny value, IloInt n=1) const
public IloIntgetSize() const
public IloBoolintersects(IloAnySet set) const
public voidremove(IloAnySet set)
public voidremove(IloAny elt)
public voidsetIntersection(IloAnySet set)
public voidsetIntersection(IloAny elt)
Inner Class
IloAnySet::Iterator For IBM® ILOG® Solver: an iterator to traverse the elements of IloAnySet.
Constructor Detail

IloAnySet

public IloAnySet(const IloEnv env, const IloAnyArray array, IloBool withIndex=IloFalse)

This constructor creates a set of enumerated values for env from the elements in array. The optional flag withIndex corresponds to the activation or not of internal Hash Tables to improve speed of add/getIndex methods.


IloAnySet

public IloAnySet(const IloEnv env, IloBool withIndex=IloFalse)

This constructor creates an empty set (no elements) for env. You must use the member function IloAnySet::add to fill this set with elements. The optional flag withIndex corresponds to the activation or not of internal Hash Tables to improve speed of add/getIndex methods.


Method Detail

add

public void add(IloAnySet set)

This member function adds set to the invoking set. By adds, we mean that the invoking set becomes the union of its former elements and the elements of set.


add

public void add(IloAny elt)

This member function adds elt to the invoking set. By adds, we mean that the invoking set becomes the union of its former elements and the new elt.


contains

public IloBool contains(IloAnySet set) const

This member function returns a Boolean value (zero or one) that specifies whether set intersects the invoking set. The value one specifies that the invoking set contains all the elements of set, and that the intersection of the invoking set with set is precisely set. The value zero specifies that the intersection of the invoking set set is not precisely set.


contains

public IloBool contains(IloAny elt) const

This member function returns a Boolean value (zero or one) that specifies whether elt is an element of the invoking set. The value one specifies that the invoking set contains elt; the value zero specifies that the invoking set does not contain elt.


copy

public IloAnySet copy() const

This member functions creates a clone of the array.


empty

public void empty()

This member function removes the elements from the invoking set. In other words, the invoking set becomes the empty set.


getNext

public IloAny getNext(IloAny value, IloInt n=1) const

This method return the value next to the given argument in the set.

If the given value does not exist, it throws an exception

If no value follows, i.e. you are at the end of the set, it throws an exception

See also getNextC, getPreviousC for circular search.


getNextC

public IloAny getNextC(IloAny value, IloInt n=1) const

This method return the value next to the given argument in the set.

If the given value does not exist, it throws an exception

If no value follows, i.e. you are at the end of the set, it will give you the first value (circular search)

See also getNext, getPrevious.


getPrevious

public IloAny getPrevious(IloAny value, IloInt n=1) const

This method return the value previous to the given argument in the set.

If the given value does not exist, it throws an exception

If no value is previous, i.e. you are at the beginning of the set, it throws an exception

See also getNextC, getPreviousC for circular search.


getPreviousC

public IloAny getPreviousC(IloAny value, IloInt n=1) const

This method return the value previous to the given argument in the set.

If the given value does not exist, it throws an exception

If no value is prvious, i.e. you are at the beginning of the set, it will give you the last value (circular search)

See also getNext, getPrevious.


getSize

public IloInt getSize() const

This member function returns an integer specifying the size of the invoking set (that is, how many elements it contains).


intersects

public IloBool intersects(IloAnySet set) const

This member function returns a Boolean value (zero or one) that specifies whether set intersects the invoking set. The value one specifies that the intersection of set and the invoking set is not empty (at least one element in common); the value zero specifies that the intersection of set and the invoking set is empty (no elements in common).


remove

public void remove(IloAnySet set)

This member function removes all the elements of set from the invoking set.


remove

public void remove(IloAny elt)

This member function removes elt from the invoking set.


setIntersection

public void setIntersection(IloAnySet set)

This member function changes the invoking set so that it includes only the elements of set. In other words, the invoking set becomes the intersection of its former elements with the elements of set.


setIntersection

public void setIntersection(IloAny elt)

This member function changes the invoking set so that it includes only the element specified by elt. In other words, the invoking set becomes the intersection of its former elements with elt.