FRAMES NO FRAMES

Class IlcActivityIterator

Definition file: ilsched/schedule.h
Include file: <ilsched/ilsched.h>

An instance of this class traverses the set of activities.

For more information, see Precedence Graph Constraints.

See Also:

Constructor and Destructor Summary
public IlcActivityIterator(const IlcSchedule schedule)
public IlcActivityIterator(IlcActivity, IlcActivityIteratorFilter filter)
Method Summary
public IlcBoolok() const
public IlcActivityoperator*() const
public IlcActivityIterator &operator++()
Constructor and Destructor Detail

IlcActivityIterator

public IlcActivityIterator(const IlcSchedule schedule)

This constructor creates an iterator to traverse all the activities of schedule during the search. If used before entering the search, this iterator will traverse an empty list of activities.


IlcActivityIterator

public IlcActivityIterator(IlcActivity, IlcActivityIteratorFilter filter)

When a schedule precedence graph is associated with the schedule of an activity, this constructor creates an iterator to traverse the subset of activities specified by the filter filter. If the schedule is not associated with a precedence graph, this constructor raises an error.

Before entering the search, only the filter IlcSuccessors is permitted. It allows the definition of an iterator that traverses the subset of activities act0 for which the successor relation (act,act0) has been added with the member function act.setSuccessor(act0). Any attempt to use another filter before entering the search will raise an error. In search, all the filters are allowed.

For example, the following loop, during the search, displays the set of activities that are direct successors of a given activity act in the precedence graph of the schedule:

   for (IlcActivityIterator ite(act, IlcDirectSuccessors);
        ite.ok();
        ++ite) {
     solver.out() << *ite << endl;
   }

Method Detail

ok

public IlcBool ok() const

This member function returns IlcTrue if the current position of the iterator is a valid one. It returns IlcFalse if all the activities have been scanned by the iterator.


operator*

public IlcActivity operator*() const

This operator returns the current instance of IlcActivity, the one to which the invoking iterator points. If the iterator is set past the end position, then this operator returns an empty handle.


operator++

public IlcActivityIterator & operator++()

This left-increment operator shifts the current position of the iterator to the next instance of IlcActivity.