|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.monica.javacom.util.MJCEqualityVector
Class for implementing a Vector like functionality with using MJCEquality for checking equality between the contained objects.
Constructor Summary | |
MJCEqualityVector(MJCEquality e,
boolean s,
boolean iR,
int m)
Default constructor. |
Method Summary | |
boolean |
add(java.lang.Object o)
Adds an object to the vector. |
int |
count(java.lang.Object o,
boolean useEquality)
Returns the number of occurances of the Object o. |
int |
firstIndex(java.lang.Object o,
boolean useEquality)
Returns the first occurance of the Object o. |
java.lang.Object |
get(int pos)
Returns the Object at the position pos. |
boolean |
insert(java.lang.Object o,
int pos)
Inserts the supplied Object o to be the supplied position pos. |
int |
lastIndex(java.lang.Object o,
boolean useEquality)
Returns the last occurance of the Object o. |
int |
length()
Returns the number of elements in the vector. |
void |
pack()
Removes all preliminarily deleted elements finally from the vector. |
void |
remove(int pos)
Removes the Object from the supplied position pos. |
boolean |
remove(java.lang.Object o,
boolean useEquality)
Removes the supplied Object o from the vector. |
void |
set(java.lang.Object o,
int pos)
Sets the supplied Object o to be the supplied position pos. |
void |
setEquality(MJCEquality e)
Sets the MJCEquality to be used. |
void |
setSynchronizing(boolean s)
Sets wether to use synchronization for all the operations, or not. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MJCEqualityVector(MJCEquality e, boolean s, boolean iR, int m)
MJCEquality
- e: the MJCEquality to be used for checking equality between contained objectsboolean
- s: wether using synchronization for all the operations or not, true=synchronizationboolean
- iR: wether to remove the removed elements from the memory list instantly or not,
true=instant removalint
- m: the maximal number of objects in this VectorMethod Detail |
public void setEquality(MJCEquality e)
MJCEquality
- e: the MJCEquality to be used for checking equality between objectspublic void setSynchronizing(boolean s)
boolean
- s: true for using synchronizationpublic boolean add(java.lang.Object o)
Object
- o: the Object to be addedpublic int firstIndex(java.lang.Object o, boolean useEquality)
Object
- o: the Object whose first occurance should be returnedboolean
- useEquality: wether to use the supplied MJCEquality or use Object.equals instead,
true=use MJCEqualitypublic int lastIndex(java.lang.Object o, boolean useEquality)
Object
- o: the Object whose last occurance should be returnedboolean
- useEquality: wether to use the supplied MJCEquality or use Object.equals instead,
true=use MJCEqualitypublic int count(java.lang.Object o, boolean useEquality)
Object
- o: the Object whose occurances should be countedboolean
- useEquality: wether to use the supplied MJCEquality or use Object.equals instead,
true=use MJCEqualitypublic java.lang.Object get(int pos) throws java.lang.Exception
int
- pos: the position of the returned ObjectArrayIndexOutOfBoundsException:
- if pos>length of the vectorException:
- if the wanted position is deletedpublic void set(java.lang.Object o, int pos) throws java.lang.ArrayIndexOutOfBoundsException
Object
- o: the Object to be setArrayIndexOutOfBoundsException:
- if pos>=length of the vectorpublic boolean insert(java.lang.Object o, int pos) throws java.lang.ArrayIndexOutOfBoundsException
Object
- o: the Object to be insertedArrayIndexOutOfBoundsException:
- if pos>length of the vectorpublic boolean remove(java.lang.Object o, boolean useEquality)
Object
- o: the Object to be removedboolean
- useEquality: wether to use the supplied MJCEquality or use Object.equals instead,
true=use MJCEqualitypublic void remove(int pos) throws java.lang.ArrayIndexOutOfBoundsException
int
- pos: the position from that the Object has to be removedArrayIndexOutOfBoundsException:
- if pos>=length of the vectorpublic void pack()
public int length()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |