public class ActivityVector extends Object
SequenceEngine
Constructor and Description |
---|
ActivityVector(String name)
Constructor.
|
ActivityVector(String name,
int bits)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addActivity(int ticks)
Appends an activity interval with the specified number of ticks.
|
void |
addInactivity(int ticks)
Appends an inactivity interval with the specified number of ticks.
|
void |
applyLogicalAnd(ActivityVector operand1,
ActivityVector operand2,
int fromTick,
int tillTick)
Applies a logical AND between the two BitSet operands and replaces the given range of this ActivityVector's BitSet with the result.
|
void |
applyLogicalAndNot(ActivityVector operand1,
ActivityVector operand2,
int fromTick,
int tillTick)
Applies a logical AND NOT between the two BitSet operands and replaces the given range of this ActivityVector's BitSet with the result.
|
void |
applyLogicalNot(ActivityVector operand,
int fromTick,
int tillTick)
Applies a logical NOT to the BitSet operand and replaces the given range of this ActivityVector's BitSet with the result.
|
void |
applyLogicalOr(ActivityVector operand1,
ActivityVector operand2,
int fromTick,
int tillTick)
Applies a logical OR between the two BitSet operands and replaces the given range of this ActivityVector's BitSet with the result.
|
void |
applyLogicalXor(ActivityVector operand1,
ActivityVector operand2,
int fromTick,
int tillTick)
Applies a logical XOR between the two BitSet operands and replaces the given range of this ActivityVector's BitSet with the result.
|
void |
flipActivityState(int from,
int till)
Flips all bits of the ActivityVector in the given tick range.
|
int |
getActiveTicks()
Returns the number of ticks this ActivityVector is active.
|
int |
getActivitySegmentCount()
Counts the number of activity segments, which is the number of consecutive blocks of activity in the vector.
|
int |
getFirstActiveTick()
Returns the tick where the ActivityVector becomes active for the first time.
|
int |
getFirstInactiveTick()
Returns the tick where the ActivityVector becomes inactive for the first time.
|
int |
getIntervalLength(int tick)
Returns the length of the interval beginning with the given tick, i.e., the number of ticks until the activity state changes or the end of the
vector is reached.
|
int |
getLastActiveTick()
Returns the tick where the ActivityVector is active for the last time.
|
String |
getName()
Returns the name of this ActivityVector.
|
int[] |
getSegmentLengths()
Returns an array that contains all activity and pause segment lengths in ticks, sorted by starting tick number.
|
int |
getTicks()
Returns the total number of ticks this ActivityVector spans.
|
boolean |
isActive(int tick)
Returns the activity state of the specified tick.
|
void |
setActivityState(int from,
int till,
boolean state)
Modifies the ActivityVector so that it has the given state in the interval from from (inclusive) to till (exclusive).
|
void |
shiftIntervalBoundaries(int startTicks,
int stopTicks)
Modifies the ActivityVector so that all interval changes from inactive to active are postponed by startTicks and all changes from active to
inactive are postponed by stopTicks ticks. startTicks and stopTicks may also be negative to prepone instead of postpone.
|
String |
toString()
Returns a string representation of the ActivityVector.
|
public ActivityVector(String name)
name
- the namepublic ActivityVector(String name, int bits)
name
- the namebits
- the initial number of bitspublic void addActivity(int ticks)
ticks
- the number of tickspublic void addInactivity(int ticks)
ticks
- the number of tickspublic boolean isActive(int tick)
tick
- the tickpublic int getIntervalLength(int tick)
tick
- the tickpublic String getName()
public int getTicks()
public int getActiveTicks()
public int getFirstActiveTick()
public int getLastActiveTick()
public int getFirstInactiveTick()
public void setActivityState(int from, int till, boolean state)
from
- the starting tick (inclusive)till
- the ending tick (exclusive)state
- the state of the intervalpublic void flipActivityState(int from, int till)
from
- the from tick (inclusive)till
- the till tick (exclusive)public void shiftIntervalBoundaries(int startTicks, int stopTicks)
startTicks
- the number of ticks to prepone or postpone startingstopTicks
- the number of ticks to prepone or postpone stoppingpublic int getActivitySegmentCount()
public String toString()
public int[] getSegmentLengths()
public void applyLogicalNot(ActivityVector operand, int fromTick, int tillTick)
operand
- the operandfromTick
- the from tick (inclusive)tillTick
- the till tick (exclusive)public void applyLogicalAnd(ActivityVector operand1, ActivityVector operand2, int fromTick, int tillTick)
operand1
- the first operandoperand2
- the second operandfromTick
- the from tick (inclusive)tillTick
- the till tick (exclusive)public void applyLogicalAndNot(ActivityVector operand1, ActivityVector operand2, int fromTick, int tillTick)
operand1
- the first operandoperand2
- the second operandfromTick
- the from tick (inclusive)tillTick
- the till tick (exclusive)public void applyLogicalOr(ActivityVector operand1, ActivityVector operand2, int fromTick, int tillTick)
operand1
- the first operandoperand2
- the second operandfromTick
- the from tick (inclusive)tillTick
- the till tick (exclusive)public void applyLogicalXor(ActivityVector operand1, ActivityVector operand2, int fromTick, int tillTick)
operand1
- the first operandoperand2
- the second operandfromTick
- the from tick (inclusive)tillTick
- the till tick (exclusive)