choco.kernel.memory
Interface IStateBinaryTree

All Known Implementing Classes:
StoredBinaryTree

public interface IStateBinaryTree

Created by IntelliJ IDEA. User: julien Date: Apr 25, 2008 Time: 9:42:15 AM Interface for a backtrackable binary tree of integer intervals


Nested Class Summary
static class IStateBinaryTree.Node
          Inner class representing a node in the binary tree a node is an interval
 
Field Summary
static int ADD
          static integer representing an operation over a binary tree ADD, a new interval has been added in the tree
static int INF
          static integer representing an operation over a binary tree INF, a lower bound of an interval has been modified
static Logger LOGGER
           
static int REM
          static integer representing an operation over a binary tree REM, an interval has been removed from the tree
static int SUP
          static integer representing an operation over a binary tree SUP, an upper bound of an interval has been modified
 
Method Summary
 void add(int a, int b)
          add a new interval [a,b] in the tree
 void add(IStateBinaryTree.Node n)
          Add a node in the tree
 void add(IStateBinaryTree.Node n, boolean save)
          Add a node in the tree and save the operation if requested
 IStateBinaryTree.Node find(int value)
          finds the node which contains the given value
 EnvironmentTrailing getEnvironment()
          Gets the Environment associated with this tree
 IStateBinaryTree.Node getFirstNode()
          Gets the node containing the lowest value in the tree
 DisposableIntIterator getIterator()
          gets an iterator over the value in the tree
 IStateBinaryTree.Node getLastNode()
          Gets the node containing the greatest value in the tree
 IStateBinaryTree.Node getRoot()
          Gets the root of the tree
 int getSize()
          Computes the size of the tree i.e. the number of value contained in the tree
 IStateBinaryTree.Node nextNode(int value)
          gets the node that contains the next integer in the tree
 IStateBinaryTree.Node nextNode(IStateBinaryTree.Node n)
          gets the next node of the given one
 IStateBinaryTree.Node prevNode(int value)
          gets the node that contains the previous integer in the tree
 IStateBinaryTree.Node prevNode(IStateBinaryTree.Node n)
          gets the previous node of the given one
 boolean remove(int value)
          Remove the given value from the tree i.e. updates the tree so that contains(value) would return false;
 void remove(IStateBinaryTree.Node n)
          Remove a node from the tree
 void remove(IStateBinaryTree.Node n, boolean save)
          Remove a node from the tree, and save the operation if requested
 String toDotty()
          get the tree in dot format
 String toString()
           
 

Field Detail

LOGGER

static final Logger LOGGER

INF

static final int INF
static integer representing an operation over a binary tree INF, a lower bound of an interval has been modified

See Also:
Constant Field Values

SUP

static final int SUP
static integer representing an operation over a binary tree SUP, an upper bound of an interval has been modified

See Also:
Constant Field Values

ADD

static final int ADD
static integer representing an operation over a binary tree ADD, a new interval has been added in the tree

See Also:
Constant Field Values

REM

static final int REM
static integer representing an operation over a binary tree REM, an interval has been removed from the tree

See Also:
Constant Field Values
Method Detail

getSize

int getSize()
Computes the size of the tree i.e. the number of value contained in the tree

Returns:
integer value of the size

find

IStateBinaryTree.Node find(int value)
finds the node which contains the given value

Parameters:
value - the value to be found
Returns:
the node which contains the value, null otherwise

remove

void remove(IStateBinaryTree.Node n)
Remove a node from the tree

Parameters:
n - the node to be removed;

remove

void remove(IStateBinaryTree.Node n,
            boolean save)
Remove a node from the tree, and save the operation if requested

Parameters:
n - the node to be removed
save - true if the removal is to be stacked in the trail

add

void add(int a,
         int b)
add a new interval [a,b] in the tree

Parameters:
a - the lower bound
b - the upper bound

add

void add(IStateBinaryTree.Node n)
Add a node in the tree

Parameters:
n - the node to be added

add

void add(IStateBinaryTree.Node n,
         boolean save)
Add a node in the tree and save the operation if requested

Parameters:
n - the node to be added
save - true id the addition is to be stacked in the trail

getRoot

IStateBinaryTree.Node getRoot()
Gets the root of the tree

Returns:
the root node of the tree

remove

boolean remove(int value)
Remove the given value from the tree i.e. updates the tree so that contains(value) would return false;

Parameters:
value - the value to be removed
Returns:
true if the value was in the domain, false otherwise

getEnvironment

EnvironmentTrailing getEnvironment()
Gets the Environment associated with this tree

Returns:
the environment associated with this tree

getFirstNode

IStateBinaryTree.Node getFirstNode()
Gets the node containing the lowest value in the tree

Returns:
first node in the tree

getLastNode

IStateBinaryTree.Node getLastNode()
Gets the node containing the greatest value in the tree

Returns:
last node in the tree

prevNode

IStateBinaryTree.Node prevNode(IStateBinaryTree.Node n)
gets the previous node of the given one

Parameters:
n - the reference node
Returns:
the previous node in the lexicographic order

nextNode

IStateBinaryTree.Node nextNode(IStateBinaryTree.Node n)
gets the next node of the given one

Parameters:
n - the reference node
Returns:
the next node in the lexicographic order

nextNode

IStateBinaryTree.Node nextNode(int value)
gets the node that contains the next integer in the tree

Parameters:
value - the value whose next is to be searched
Returns:
the node containing the next value

prevNode

IStateBinaryTree.Node prevNode(int value)
gets the node that contains the previous integer in the tree

Parameters:
value - the value whose previous is to be searched
Returns:
the node containing the previous value

toString

String toString()
Overrides:
toString in class Object

getIterator

DisposableIntIterator getIterator()
gets an iterator over the value in the tree

Returns:
an TreeIterator implementing IntIterator

toDotty

String toDotty()
get the tree in dot format

Returns:
a string


Copyright © 2012. All Rights Reserved.