|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.core.FastVector
Implements a fast vector class without synchronized methods. Replaces java.util.Vector. (Synchronized methods tend to be slow.)
Nested Class Summary | |
class |
FastVector.FastVectorEnumeration
Class for enumerating the vector's elements. |
Constructor Summary | |
FastVector()
Constructs an empty vector with initial capacity zero. |
|
FastVector(int capacity)
Constructs a vector with the given capacity. |
|
FastVector(int capacity,
int capIncrement,
double capMultiplier)
Constructs a vector with the given capacity, capacity increment and capacity mulitplier. |
Method Summary | |
void |
addElement(java.lang.Object element)
Adds an element to this vector. |
void |
appendElements(FastVector toAppend)
Appends all elements of the supplied vector to this vector. |
int |
capacity()
Returns the capacity of the vector. |
boolean |
contains(java.lang.Object o)
added by akibriya |
java.lang.Object |
copy()
Produces a shallow copy of this vector. |
java.lang.Object |
copyElements()
Clones the vector and shallow copies all its elements. |
java.lang.Object |
elementAt(int index)
Returns the element at the given position. |
java.util.Enumeration |
elements()
Returns an enumeration of this vector. |
java.util.Enumeration |
elements(int index)
Returns an enumeration of this vector, skipping the element with the given index. |
java.lang.Object |
firstElement()
Returns the first element of the vector. |
int |
indexOf(java.lang.Object element)
Searches for the first occurence of the given argument, testing for equality using the equals method. |
void |
insertElementAt(java.lang.Object element,
int index)
Inserts an element at the given position. |
java.lang.Object |
lastElement()
Returns the last element of the vector. |
void |
removeAllElements()
Removes all components from this vector and sets its size to zero. |
void |
removeElementAt(int index)
Deletes an element from this vector. |
void |
setCapacity(int capacity)
Sets the vector's capacity to the given value. |
void |
setElementAt(java.lang.Object element,
int index)
Sets the element at the given index. |
int |
size()
Returns the vector's current size. |
void |
swap(int first,
int second)
Swaps two elements in the vector. |
java.lang.Object[] |
toArray()
Returns all the elements of this vector as an array |
void |
trimToSize()
Sets the vector's capacity to its size. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public FastVector()
public FastVector(int capacity)
capacity
- the vector's initial capacitypublic FastVector(int capacity, int capIncrement, double capMultiplier)
capacity
- the vector's initial capacityMethod Detail |
public final void addElement(java.lang.Object element)
element
- the element to addpublic final int capacity()
public final java.lang.Object copy()
copy
in interface Copyable
public final java.lang.Object copyElements()
public final java.lang.Object elementAt(int index)
index
- the element's index
public final java.util.Enumeration elements()
public final java.util.Enumeration elements(int index)
index
- the element to skip
public boolean contains(java.lang.Object o)
public final java.lang.Object firstElement()
public final int indexOf(java.lang.Object element)
element
- the element to be found
public final void insertElementAt(java.lang.Object element, int index)
element
- the element to be insertedindex
- the element's indexpublic final java.lang.Object lastElement()
public final void removeElementAt(int index)
index
- the index of the element to be deletedpublic final void removeAllElements()
public final void appendElements(FastVector toAppend)
toAppend
- the FastVector containing elements to append.public final java.lang.Object[] toArray()
public final void setCapacity(int capacity)
capacity
- the new capacitypublic final void setElementAt(java.lang.Object element, int index)
element
- the element to be put into the vectorindex
- the index at which the element is to be placedpublic final int size()
public final void swap(int first, int second)
first
- index of the first elementsecond
- index of the second elementpublic final void trimToSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London