org.moyoman.util.igo
Class VecInt

java.lang.Object
  |
  +--org.moyoman.util.igo.VecInt
All Implemented Interfaces:
Cloneable, Serializable

public class VecInt
extends Object
implements Cloneable, Serializable

A vector class for int.

See Also:
Serialized Form

Field Summary
private  int[] arr
          An array to store elements.
private  int pSize
          The size to add when extending the capacity.
private  int sp
          The count of the elements.
 
Constructor Summary
VecInt()
          Constructor.
VecInt(int size)
          Constructor.
VecInt(int size, int pz)
          Constructor.
 
Method Summary
 int add(int i)
          Add a element.
 int at(int i)
          Get value from a element.
 void clear()
          Clear all element.
 Object clone()
          Get clone object.
 void del(int i)
          Delete a element.
 boolean in(int i)
          Check the index is effective or not.
 void set(int i, int v)
          Set value to a element.
 int size()
          Get the count of all elements.
 int[] toArr()
          Convert this object to a int array.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sp

private int sp
The count of the elements.


arr

private int[] arr
An array to store elements.


pSize

private int pSize
The size to add when extending the capacity.

Constructor Detail

VecInt

public VecInt()
Constructor.


VecInt

public VecInt(int size)
Constructor.

Parameters:
size - The size of the capacity.

VecInt

public VecInt(int size,
              int pz)
Constructor.

Parameters:
size - The size of the capacity.
pz - The size to add when extend the capacity.
Method Detail

add

public int add(int i)
Add a element.

Parameters:
i - The value of the new element.
Returns:
the value of the new element.

del

public void del(int i)
Delete a element.

Parameters:
i - The index of the target element.

in

public boolean in(int i)
Check the index is effective or not.

Parameters:
i - The index.
Returns:
true if the index is effective.

set

public void set(int i,
                int v)
Set value to a element.

Parameters:
i - The index of the element.
v - The value to set to the element.

at

public int at(int i)
Get value from a element.

Parameters:
i - The index of the element.
Returns:
the value of the element.

clear

public void clear()
Clear all element.


size

public int size()
Get the count of all elements.

Returns:
the count of the elements.

toArr

public int[] toArr()
Convert this object to a int array.

Returns:
a int array of this object.

clone

public Object clone()
Get clone object.

Overrides:
clone in class Object
Returns:
a clone object of VecInt.