choco.kernel.memory.structure
Class StoredIntBipartiteList

java.lang.Object
  extended by choco.kernel.memory.structure.StoredIntBipartiteList
All Implemented Interfaces:
IStateIntVector

public final class StoredIntBipartiteList
extends Object
implements IStateIntVector

A stored list dedicated to two operations : - iteration - removal of an element during iteration It only requires a StoredInt to denote the first element of the list and proceeds by swapping element with the first one to remove them and incrementing the index of the first element. IT DOES NOT PRESERVE THE ORDER OF THE LIST


Field Summary
 
Fields inherited from interface choco.kernel.memory.IStateIntVector
LOGGER, MIN_CAPACITY
 
Constructor Summary
StoredIntBipartiteList(IEnvironment environment, int[] values)
           
 
Method Summary
 void add(int i)
          Adds a new search at the end of the vector.
 boolean contain(int val)
           
 int get(int index)
          Returns the indexth element of the vector.
 DisposableIntIterator getIterator()
           
 DisposableIntIterator getRemIterator()
           
 boolean isEmpty()
          Checks if the vector is empty.
 String pretty()
           
 int quickGet(int index)
          access an element without any bound check
 int quickSet(int index, int val)
          Assigns a new value val to the element indexth and return the old value without bound check
 void remove(int i)
          Removes an int.
 void removeLast()
          removes the search at the end of the vector.
 int set(int index, int val)
          Assigns a new value val to the element index and returns the old value
 int size()
          Returns the current size of the stored search vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoredIntBipartiteList

public StoredIntBipartiteList(IEnvironment environment,
                              int[] values)
Method Detail

size

public int size()
Description copied from interface: IStateIntVector
Returns the current size of the stored search vector.

Specified by:
size in interface IStateIntVector

isEmpty

public boolean isEmpty()
Description copied from interface: IStateIntVector
Checks if the vector is empty.

Specified by:
isEmpty in interface IStateIntVector

add

public void add(int i)
Description copied from interface: IStateIntVector
Adds a new search at the end of the vector.

Specified by:
add in interface IStateIntVector
Parameters:
i - The search to add.

remove

public void remove(int i)
Description copied from interface: IStateIntVector
Removes an int.

Specified by:
remove in interface IStateIntVector
Parameters:
i - The search to remove.

removeLast

public void removeLast()
Description copied from interface: IStateIntVector
removes the search at the end of the vector. does nothing when called on an empty vector

Specified by:
removeLast in interface IStateIntVector

get

public int get(int index)
Description copied from interface: IStateIntVector
Returns the indexth element of the vector.

Specified by:
get in interface IStateIntVector

quickGet

public int quickGet(int index)
Description copied from interface: IStateIntVector
access an element without any bound check

Specified by:
quickGet in interface IStateIntVector
Returns:

contain

public boolean contain(int val)
Specified by:
contain in interface IStateIntVector

set

public int set(int index,
               int val)
Description copied from interface: IStateIntVector
Assigns a new value val to the element index and returns the old value

Specified by:
set in interface IStateIntVector

quickSet

public int quickSet(int index,
                    int val)
Description copied from interface: IStateIntVector
Assigns a new value val to the element indexth and return the old value without bound check

Specified by:
quickSet in interface IStateIntVector
Parameters:
index - the index where the value is modified
val - the new value
Returns:
the old value

getIterator

public DisposableIntIterator getIterator()
Specified by:
getIterator in interface IStateIntVector

getRemIterator

public DisposableIntIterator getRemIterator()

pretty

public String pretty()


Copyright © 2012. All Rights Reserved.