choco.kernel.memory.copy
Class RcDoubleVector

java.lang.Object
  extended by choco.kernel.memory.copy.RcDoubleVector
All Implemented Interfaces:
RecomputableElement, IStateDoubleVector

public class RcDoubleVector
extends Object
implements IStateDoubleVector, RecomputableElement


Field Summary
static int MIN_CAPACITY
          Minimal capacity of a vector
 
Fields inherited from interface choco.kernel.memory.IStateDoubleVector
LOGGER
 
Fields inherited from interface choco.kernel.memory.copy.RecomputableElement
BOOL, DOUBLE, DOUBLEVECTOR, INT, INTVECTOR, LONG, LONGVECTOR, NB_TYPE, OBJECT, VECTOR
 
Constructor Summary
RcDoubleVector(EnvironmentCopying env)
          Constructs an empty stored search vector.
RcDoubleVector(EnvironmentCopying env, double[] entries)
           
RcDoubleVector(EnvironmentCopying env, int initialSize, double initialValue)
          Constructs a stored search vector with an initial size, and initial values.
 
Method Summary
 void _set(double[] vals)
           
 void _set(double[] vals, int timeStamp)
           
 void add(double i)
          Adds a new search at the end of the vector.
 double[] deepCopy()
           
 void ensureCapacity(int minCapacity)
          Checks if the capacity is great enough, else the capacity is extended.
 double get(int index)
          Returns the indexth element of the vector.
 DisposableIntIterator getIterator()
           
 int getTimeStamp()
           
 int getType()
           
 boolean isEmpty()
          Checks if the vector is empty.
 double quickGet(int index)
          return the indexth element of the vector without an bound check.
 double quickSet(int index, double val)
          Unsafe setter => don't do bound verification
 void remove(int i)
          Removes an int.
 void removeLast()
          removes the search at the end of the vector.
 double set(int index, double val)
          Assigns a new value val to the element index.
 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
 

Field Detail

MIN_CAPACITY

public static final int MIN_CAPACITY
Minimal capacity of a vector

See Also:
Constant Field Values
Constructor Detail

RcDoubleVector

public RcDoubleVector(EnvironmentCopying env,
                      int initialSize,
                      double initialValue)
Constructs a stored search vector with an initial size, and initial values.

Parameters:
env - The current environment.
initialSize - The initial size.
initialValue - The initial common value.

RcDoubleVector

public RcDoubleVector(EnvironmentCopying env,
                      double[] entries)

RcDoubleVector

public RcDoubleVector(EnvironmentCopying env)
Constructs an empty stored search vector.

Parameters:
env - The current environment.
Method Detail

size

public int size()
Returns the current size of the stored search vector.

Specified by:
size in interface IStateDoubleVector

isEmpty

public boolean isEmpty()
Checks if the vector is empty.

Specified by:
isEmpty in interface IStateDoubleVector

ensureCapacity

public void ensureCapacity(int minCapacity)
Checks if the capacity is great enough, else the capacity is extended.

Parameters:
minCapacity - the necessary capacity.

add

public void add(double i)
Adds a new search at the end of the vector.

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

removeLast

public void removeLast()
removes the search at the end of the vector. does nothing when called on an empty vector

Specified by:
removeLast in interface IStateDoubleVector

get

public double get(int index)
Returns the indexth element of the vector.

Specified by:
get in interface IStateDoubleVector

quickGet

public final double quickGet(int index)
Description copied from interface: IStateDoubleVector
return the indexth element of the vector without an bound check.

Specified by:
quickGet in interface IStateDoubleVector
Parameters:
index - index
Returns:
the element

set

public double set(int index,
                  double val)
Assigns a new value val to the element index.

Specified by:
set in interface IStateDoubleVector

quickSet

public double quickSet(int index,
                       double val)
Description copied from interface: IStateDoubleVector
Unsafe setter => don't do bound verification

Specified by:
quickSet in interface IStateDoubleVector
Parameters:
index - the index of the replaced value
val - the new value
Returns:
the old value

remove

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

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

_set

public void _set(double[] vals)

_set

public void _set(double[] vals,
                 int timeStamp)

deepCopy

public double[] deepCopy()

getType

public int getType()
Specified by:
getType in interface RecomputableElement

getTimeStamp

public int getTimeStamp()
Specified by:
getTimeStamp in interface RecomputableElement

getIterator

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


Copyright © 2012. All Rights Reserved.