Package coneforest.psylla.core
Class PsyBitArray
java.lang.Object
coneforest.psylla.core.PsyBitArray
- All Implemented Interfaces:
PsyAppendable<PsyBoolean>
,PsyBitwise<PsyBitArray>
,PsyClearable
,PsyContainer<PsyBoolean>
,PsyConvertableToName
,PsyConvertableToString
,PsyFormalArray<PsyBoolean>
,PsyIndexed<PsyInteger,
,PsyBoolean> PsyIterable<PsyBoolean>
,PsyLengthy
,PsyLogical<PsyBitArray>
,PsyObject
,PsySequential<PsyBoolean>
,PsyStreamable<PsyBoolean>
,Iterable<PsyBoolean>
public class PsyBitArray
extends Object
implements PsyFormalArray<PsyBoolean>, PsyBitwise<PsyBitArray>
A representation of
bitarray
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(int index) extract
(int indexValue) get
(int index) void
insert
(int index, PsyBoolean oBoolean) Inserts the specifiedobject
into this array at the position specified by a given index.iterator()
int
length()
Returns a length of this object.psyAnd
(PsyBitArray oBitArray) Returns a result of logical conjunction of this object and given object.void
psyAppend
(PsyBoolean oBoolean) Appends a givenobject
to this container.psyBitShift
(PsyInteger oShift) Returns abitwise
whose value is equivalent to this value with bits shifted at the given distance.void
psyClear()
Clear this object.psyClearBit
(PsyInteger oBit) Returns abitwise
whose value is equivalent to this value with the designated bit cleared.psyClone()
Returns a clone of this object.psyExtractInterval
(PsyInteger oStart, PsyInteger oCount) psyFlipBit
(PsyInteger oBit) Returns abitwise
whose value is equivalent to this value with the designated bit flipped.psyGetInterval
(PsyInteger oIndex, PsyInteger oCount) psyNot()
Returns a result of logical negation of this object.psyOr
(PsyBitArray oBitArray) Returns a result of logical disjunction of this object and given object.void
psyPutInterval
(PsyInteger oIndex, PsyIterable<? extends PsyBoolean> oIterable) psySetBit
(PsyInteger oBit) Returns abitwise
whose value is equivalent to this value with the designated bit set.void
psySetLength
(PsyInteger oLength) psySlice
(PsyIterable<PsyInteger> oIndices) Returns a container of the same type as this object consisting of keys or indices from giveniterable
and of associated values.psyTestBit
(PsyInteger oBit) Returns aboolean
indicating if the designated bit is set.psyXor
(PsyBitArray oBitArray) Returns a result of logical exclusive disjunction of this object and given object.void
put
(int index, PsyBoolean oBoolean) Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface coneforest.psylla.core.PsyAppendable
psyAppendAll
Methods inherited from interface coneforest.psylla.core.PsyContainer
psyNewEmpty
Methods inherited from interface coneforest.psylla.core.PsyFormalArray
psyDelete, psyEntries, psyExtract, psyGet, psyGetAll, psyInsert, psyInsertAll, psyKeys, psyKnown, psyPostChop, psyPreChop, psyPrepend, psyPrependAll, psyPut, psyReplicate, psyReverse, psyValues, toSyntaxString, toSyntaxStringHelper
Methods inherited from interface coneforest.psylla.core.PsyIterable
psyStream, psyToArray, psyUnite
Methods inherited from interface coneforest.psylla.core.PsyLengthy
isEmpty, psyIsEmpty, psyLength
Methods inherited from interface coneforest.psylla.core.PsyObject
convert, execute, invoke, psyEq, psyHashCode, psyInstanceOf, psyNe, psySyntax, psyToName, psyToString, psyType, typeName
Methods inherited from interface coneforest.psylla.core.PsyStreamable
psyForAll
-
Field Details
-
OPERATORS
-
-
Constructor Details
-
PsyBitArray
public PsyBitArray()Creates a new emptybitarray
. -
PsyBitArray
-
-
Method Details
-
get
- Specified by:
get
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
psyGetInterval
- Specified by:
psyGetInterval
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
put
- Specified by:
put
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
psyPutInterval
public void psyPutInterval(PsyInteger oIndex, PsyIterable<? extends PsyBoolean> oIterable) throws PsyErrorException - Specified by:
psyPutInterval
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
psyAppend
Description copied from interface:PsyAppendable
Appends a givenobject
to this container.- Specified by:
psyAppend
in interfacePsyAppendable<PsyBoolean>
- Parameters:
oBoolean
- anobject
to append.
-
insert
Description copied from interface:PsyFormalArray
Inserts the specifiedobject
into this array at the position specified by a given index.- Specified by:
insert
in interfacePsyFormalArray<PsyBoolean>
- Parameters:
index
- ainteger
index.oBoolean
- aobject
.
-
delete
- Specified by:
delete
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
extract
- Specified by:
extract
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
psyExtractInterval
public PsyBitArray psyExtractInterval(PsyInteger oStart, PsyInteger oCount) throws PsyErrorException - Specified by:
psyExtractInterval
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
psyNot
Description copied from interface:PsyLogical
Returns a result of logical negation of this object.- Specified by:
psyNot
in interfacePsyLogical<PsyBitArray>
- Returns:
- a result.
-
psyOr
Description copied from interface:PsyLogical
Returns a result of logical disjunction of this object and given object.- Specified by:
psyOr
in interfacePsyLogical<PsyBitArray>
- Parameters:
oBitArray
- given object.- Returns:
- a result.
-
psyAnd
Description copied from interface:PsyLogical
Returns a result of logical conjunction of this object and given object.- Specified by:
psyAnd
in interfacePsyLogical<PsyBitArray>
- Parameters:
oBitArray
- given object.- Returns:
- a result.
-
psyXor
Description copied from interface:PsyLogical
Returns a result of logical exclusive disjunction of this object and given object.- Specified by:
psyXor
in interfacePsyLogical<PsyBitArray>
- Parameters:
oBitArray
- given object.- Returns:
- a result.
-
psyBitShift
Description copied from interface:PsyBitwise
Returns abitwise
whose value is equivalent to this value with bits shifted at the given distance. If the distance is negative, the left shift is preformed. If the distance is positive, the right shift is preformed. If the distance is zero, returns this.- Specified by:
psyBitShift
in interfacePsyBitwise<PsyBitArray>
- Parameters:
oShift
- the shift distance.- Returns:
- a
bitwise
whose value is equivalent to this value with bits shifted at the given distance.
-
psyTestBit
Description copied from interface:PsyBitwise
Returns aboolean
indicating if the designated bit is set.- Specified by:
psyTestBit
in interfacePsyBitwise<PsyBitArray>
- Parameters:
oBit
- the index of bit to test.- Returns:
- a
boolean
indicating if the designated bit set. - Throws:
PsyRangeCheckException
-
psySetBit
Description copied from interface:PsyBitwise
Returns abitwise
whose value is equivalent to this value with the designated bit set.- Specified by:
psySetBit
in interfacePsyBitwise<PsyBitArray>
- Parameters:
oBit
- the index of bit to set.- Returns:
- a
bitwise
whose value is equivalent to this value with the designated bit set. - Throws:
PsyRangeCheckException
-
psyFlipBit
Description copied from interface:PsyBitwise
Returns abitwise
whose value is equivalent to this value with the designated bit flipped.- Specified by:
psyFlipBit
in interfacePsyBitwise<PsyBitArray>
- Parameters:
oBit
- the index of bit to flip.- Returns:
- a
bitwise
whose value is equivalent to this value with the designated bit flipped. - Throws:
PsyRangeCheckException
-
psyClearBit
Description copied from interface:PsyBitwise
Returns abitwise
whose value is equivalent to this value with the designated bit cleared.- Specified by:
psyClearBit
in interfacePsyBitwise<PsyBitArray>
- Parameters:
oBit
- the index of bit to clear.- Returns:
- a
bitwise
whose value is equivalent to this value with the designated bit cleared. - Throws:
PsyRangeCheckException
-
iterator
- Specified by:
iterator
in interfaceIterable<PsyBoolean>
-
length
public int length()Description copied from interface:PsyLengthy
Returns a length of this object.- Specified by:
length
in interfacePsyLengthy
- Returns:
- a length.
-
psySlice
Description copied from interface:PsyIndexed
Returns a container of the same type as this object consisting of keys or indices from giveniterable
and of associated values.- Specified by:
psySlice
in interfacePsyFormalArray<PsyBoolean>
- Specified by:
psySlice
in interfacePsyIndexed<PsyInteger,
PsyBoolean> - Parameters:
oIndices
- an enumeration of keys.- Returns:
- a container.
- Throws:
PsyErrorException
- when key is absent or index is out of range.
-
psySetLength
- Specified by:
psySetLength
in interfacePsyFormalArray<PsyBoolean>
- Throws:
PsyErrorException
-
psyClone
Description copied from interface:PsyObject
Returns a clone of this object.- Specified by:
psyClone
in interfacePsyFormalArray<PsyBoolean>
- Specified by:
psyClone
in interfacePsyObject
- Returns:
- a clone of this object.
-
psyClear
public void psyClear()Description copied from interface:PsyClearable
Clear this object.- Specified by:
psyClear
in interfacePsyClearable
-