public abstract class Set_Swap extends Object implements ISet
Modifier and Type | Field and Description |
---|---|
protected int[] |
array |
protected int |
arrayLength |
protected int |
currentIdx |
protected int |
size |
protected int |
sizeMax |
Constructor and Description |
---|
Set_Swap(int n) |
Modifier and Type | Method and Description |
---|---|
protected void |
addSize(int delta) |
void |
clear()
Remove all elements from the set
|
int |
getFirstElement() |
int |
getMaxSize()
Gets the maximum size of the set, or -1 if it is unbounded.
|
int |
getNextElement()
enables to iterate over the set
should be used as follow :
for(int i=getFirstElement(); i>=0; i = getNextElement()){
...
}
The use of getFirstElement() is necessary to ensure a complete iteration
WARNING cannot encapsulate two for loops (copy the set for that)
|
int |
getSize() |
boolean |
isEmpty() |
protected void |
setSize(int s) |
int[] |
toArray()
Copies the set in an array if integers
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
add, contain, getSetType, remove
protected int arrayLength
protected int currentIdx
protected int size
protected final int sizeMax
protected int[] array
public boolean isEmpty()
public int getSize()
protected void setSize(int s)
protected void addSize(int delta)
public void clear()
ISet
public int getFirstElement()
getFirstElement
in interface ISet
public int getNextElement()
ISet
getNextElement
in interface ISet
public int[] toArray()
ISet
public int getMaxSize()
ISet
getMaxSize
in interface ISet
Copyright © 2015. All rights reserved.