choco.kernel.common.util.objects
Class BipartiteSet<E>

java.lang.Object
  extended by choco.kernel.common.util.objects.BipartiteSet<E>

public final class BipartiteSet<E>
extends Object

Implements a bipartite set.

Cette classe est utilisee pour stocker les evenements de propagation de contrainte : les elements de gauche sont a propages, les autres ne doivent pas etre propages.


Constructor Summary
BipartiteSet()
          Constructs a new bipartite set.
 
Method Summary
 void addLeft(E object)
          Adds an object to the left part of the set.
 void addRight(E object)
          Adds an object to the right part of the set.
 void clear()
          Clear datastructures for safe reuses
 int getNbLeft()
          Returns the number of elements in the left part.
 int getNbObjects()
          Returns the number of objects in the set.
 int getNbRight()
          Returns the number of elements in the right part.
 boolean isIn(E object)
          Checks if the object is in the set.
 boolean isLeft(E object)
          Checks if the object is in the left part of the set.
 Iterator<E> leftIterator()
          Iterator without a valid remove method !
 void moveAllLeft()
          Moves all the objects to the left part.
 void moveAllRight()
          Moves all the objects to the right part.
 E moveLastLeft()
          Move the last element in the left part to the right part.
 void moveLeft(E object)
          Moves the object the left part of the set if needed.
 void moveRight(E object)
          Moves the object the right part of the set if needed.
 Iterator<E> rightIterator()
          Iterator without a valid remove method !
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BipartiteSet

public BipartiteSet()
Constructs a new bipartite set. Initialized internal util.

Method Detail

clear

public void clear()
Clear datastructures for safe reuses


moveLeft

public void moveLeft(E object)
Moves the object the left part of the set if needed.


moveRight

public void moveRight(E object)
Moves the object the right part of the set if needed.


moveAllLeft

public void moveAllLeft()
Moves all the objects to the left part.


moveAllRight

public void moveAllRight()
Moves all the objects to the right part.


addRight

public void addRight(E object)
Adds an object to the right part of the set.


addLeft

public void addLeft(E object)
Adds an object to the left part of the set.


isLeft

public boolean isLeft(E object)
Checks if the object is in the left part of the set.


isIn

public boolean isIn(E object)
Checks if the object is in the set.


getNbLeft

public int getNbLeft()
Returns the number of elements in the left part.


getNbRight

public int getNbRight()
Returns the number of elements in the right part.


getNbObjects

public int getNbObjects()
Returns the number of objects in the set.


moveLastLeft

public E moveLastLeft()
Move the last element in the left part to the right part.

Returns:
The moved element.

leftIterator

public Iterator<E> leftIterator()
Iterator without a valid remove method ! Warning : suppose the set is not modified suring iterating !


rightIterator

public Iterator<E> rightIterator()
Iterator without a valid remove method ! Warning : suppose the set is not modified suring iterating !



Copyright © 2012. All Rights Reserved.