Package org.basex.util.list
Class BoolList
java.lang.Object
org.basex.util.list.ElementList
org.basex.util.list.BoolList
Resizable-array implementation for native booleans.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields inherited from class org.basex.util.list.ElementList
factor, size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(boolean element) Adds an element.add(boolean... elements) Adds elements to the array.booleanboolean[]finish()Returns an array with all elements and invalidates the internal array.booleanget(int index) Returns the element at the specified index.boolean[]next()Returns an array with all elements and resets the array size.booleanpeek()Returns the uppermost element on the stack, without removing it.booleanpop()Pops the uppermost element from the stack.voidpush(boolean element) Pushes an element onto the stack.voidset(int index, boolean element) Stores an element at the specified index.boolean[]toArray()Finishes the int array.toString()Methods inherited from class org.basex.util.list.ElementList
isEmpty, newCapacity, newCapacity, reset, size, size
-
Constructor Details
-
BoolList
public BoolList()Default constructor. -
BoolList
public BoolList(long capacity) Constructor with initial capacity.- Parameters:
capacity- array capacity
-
-
Method Details
-
add
Adds an element.- Parameters:
element- element to be added- Returns:
- self reference
-
add
Adds elements to the array.- Parameters:
elements- elements to be added- Returns:
- self reference
-
get
public boolean get(int index) Returns the element at the specified index.- Parameters:
index- index of the element to return- Returns:
- element
-
set
public void set(int index, boolean element) Stores an element at the specified index.- Parameters:
index- index of the element to replaceelement- element to be stored
-
pop
public boolean pop()Pops the uppermost element from the stack.- Returns:
- the popped element
-
push
public void push(boolean element) Pushes an element onto the stack.- Parameters:
element- element
-
peek
public boolean peek()Returns the uppermost element on the stack, without removing it.- Returns:
- uppermost element
-
toArray
public boolean[] toArray()Finishes the int array.- Returns:
- int array
-
next
public boolean[] next()Returns an array with all elements and resets the array size.- Returns:
- array
-
finish
public boolean[] finish()Returns an array with all elements and invalidates the internal array. Warning: the function must only be called if the list is discarded afterwards.- Returns:
- array (internal representation!)
-
equals
-
toString
-