public final class CompositeDisplayCondition extends DisplayCondition implements Iterable<DisplayCondition>, IDisposable
BinaryLogicOperation
.
For example, several TimeIntervalDisplayCondition
objects can be added to a composite. The composite can then be assigned to an object
so the object is only
rendered
when the current animation time is within one of the time intervals.Constructor and Description |
---|
CompositeDisplayCondition()
Initializes an empty composite display condition.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DisplayCondition displayCondition)
Adds a display condition to the end of the composite.
|
void |
add(DisplayCondition displayCondition,
boolean negate)
Adds a display condition to the end of the composite.
|
void |
clear()
Removes all display conditions from the composite.
|
protected void |
dispose(boolean disposing) |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
DisplayCondition |
get(int index)
Returns the condition at the given zero-based index.
|
int |
getCapacity()
Gets the number of display conditions for which memory has been allocated.
|
int |
getCount()
Gets the number of display conditions in the composite.
|
BinaryLogicOperation |
getLogicOperation()
Gets the binary logic operation applied to all display conditions in the composite
when the composite is evaluated.
|
boolean |
getNegate(DisplayCondition displayCondition)
Determines if a logical
not operation is applied to a display condition
in the composite. |
boolean |
getNegate(int index)
Determines if a logical
not operation is applied to a display condition
in the composite. |
void |
insert(int index,
DisplayCondition displayCondition)
Inserts a display condition at the given zero-based
index ,
shifting existing display conditions. |
void |
insert(int index,
DisplayCondition displayCondition,
boolean negate)
Inserts a display condition at the given zero-based
index ,
shifting existing display conditions. |
Iterator<DisplayCondition> |
iterator()
Returns an enumerator that iterates through the collection.
|
void |
remove(DisplayCondition displayCondition)
Removes a display condition from the composite.
|
void |
remove(int index)
Removes the display condition at the given zero-based
index ,
shifting existing display conditions. |
void |
reserve(int count)
Requests enough memory for the composite to contain at least
count
display conditions. |
void |
setLogicOperation(BinaryLogicOperation value)
Sets the binary logic operation applied to all display conditions in the composite
when the composite is evaluated.
|
void |
setNegate(DisplayCondition displayCondition,
boolean negate)
Sets if a logical
not operation is applied to a display condition
in the composite when the composite is evaluated. |
void |
setNegate(int index,
boolean negate)
Sets if a logical
not operation is applied to a display condition
in the composite when the composite is evaluated. |
dispose
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
close, dispose
public CompositeDisplayCondition()
An empty composite display condition evaluates to true
, so when an
empty composite is assigned to an object, the object is always
rendered.
protected void finalize() throws Throwable
java.lang.Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the Java™ virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
finalize
in class Object
Throwable
- the Exception
raised by this methodWeakReference
,
PhantomReference
protected void dispose(boolean disposing)
dispose
in class DisplayCondition
public int getCount()
public final int getCapacity()
Count
.public final BinaryLogicOperation getLogicOperation()
and
and or
operations
in the same expression, create composites containing composites.UnsupportedCaseException
- LogicOperation
must be a valid value in BinaryLogicOperation
.public final void setLogicOperation(BinaryLogicOperation value)
and
and or
operations
in the same expression, create composites containing composites.UnsupportedCaseException
- LogicOperation
must be a valid value in BinaryLogicOperation
.public DisplayCondition get(int index)
ArgumentOutOfRangeException
- index
is out of range. It must be between 0 and Count
- 1
.public Iterator<DisplayCondition> iterator()
iterator
in interface Iterable<DisplayCondition>
public final void reserve(int count)
count
display conditions. Count
will not be affected but
Capacity
may be.count
- The number of display conditions to request memory for.ArgumentOutOfRangeException
- count
must be greater than or equal to zero.public void add(DisplayCondition displayCondition, boolean negate)
displayCondition
- The display condition to add to the composite.negate
- When true, a logical not
is applied to displayCondition
when the composite display condition is evaluated.ArgumentNullException
- displayCondition
is null
.CompositeDisplayCondition.insert(int,agi.foundation.graphics.DisplayCondition,boolean)
public void add(DisplayCondition displayCondition)
displayCondition
- The display condition to add to the composite.ArgumentNullException
- displayCondition
is null
.CompositeDisplayCondition.insert(int,agi.foundation.graphics.DisplayCondition)
public final void insert(int index, DisplayCondition displayCondition, boolean negate)
index
,
shifting existing display conditions.index
- The zero-based index to insert the display condition at.displayCondition
- The display condition to insert into the composite.negate
- When true, a logical not
is applied to displayCondition
when the composite display condition is evaluated.ArgumentNullException
- displayCondition
is null
.ArgumentOutOfRangeException
- Index is out of range. It must be between 0 and Count
.CompositeDisplayCondition.add(agi.foundation.graphics.DisplayCondition,boolean)
public final void insert(int index, DisplayCondition displayCondition)
index
,
shifting existing display conditions.index
- The zero-based index to insert the display condition at.displayCondition
- The display condition to insert into the composite.ArgumentNullException
- displayCondition
is null
.ArgumentOutOfRangeException
- Index is out of range. It must be between 0 and Count
.CompositeDisplayCondition.add(agi.foundation.graphics.DisplayCondition)
public void remove(DisplayCondition displayCondition)
This call has no effect if displayCondition
is null
or
does not exist in the composite.
displayCondition
- The display condition to remove from the composite.CompositeDisplayCondition.remove(int)
public final void remove(int index)
index
,
shifting existing display conditions.index
- The zero-based index of the display condition to remove.ArgumentOutOfRangeException
- Index is out of range. It must be between 0 and Count
- 1
.CompositeDisplayCondition.remove(agi.foundation.graphics.DisplayCondition)
public final void clear()
An empty composite display condition evaluates to true
, so when an
empty composite is assigned to an object, the object is always
rendered.
public boolean getNegate(DisplayCondition displayCondition)
not
operation is applied to a display condition
in the composite.
Display conditions can be in more than one composite at a time. Each composite may or may not negate the display condition. So a display condition that is negated in one composite is not necessarily negated in another.
displayCondition
- The display condition to check.not
operation is applied to the display condition
when the composite is evaluated.ArgumentNullException
- displayCondition
is null
.ArgumentException
- displayCondition
does not exist in the composite.CompositeDisplayCondition.getNegate(int)
public final void setNegate(DisplayCondition displayCondition, boolean negate)
not
operation is applied to a display condition
in the composite when the composite is evaluated.
Display conditions can be in more than one composite at a time. Each composite may or may not negate the display condition. So a display condition that is negated in one composite is not necessarily negated in another.
displayCondition
- The display condition to set the logical not
operation for.negate
- True if displayCondition
should be negated.ArgumentNullException
- displayCondition
is null
.ArgumentException
- displayCondition
does not exist in the composite.CompositeDisplayCondition.setNegate(int,boolean)
public boolean getNegate(int index)
not
operation is applied to a display condition
in the composite.
Display conditions can be in more than one composite at a time. Each composite may or may not negate the display condition. So a display condition that is negated in one composite is not necessarily negated in another.
index
- The zero-based index of the display condition to check.not
operation is applied to the display condition
when the composite is evaluated.ArgumentOutOfRangeException
- Index is out of range. It must be between 0 and Count
- 1
.CompositeDisplayCondition.getNegate(agi.foundation.graphics.DisplayCondition)
public final void setNegate(int index, boolean negate)
not
operation is applied to a display condition
in the composite when the composite is evaluated.
Display conditions can be in more than one composite at a time. Each composite may or may not negate the display condition. So a display condition that is negated in one composite is not necessarily negated in another.
index
- The zero-based index of the display condition to set the
logical not
operation for.negate
- True if the display condition with the given index
should be negated.ArgumentOutOfRangeException
- Index is out of range. It must be between 0 and Count
- 1
.CompositeDisplayCondition.setNegate(agi.foundation.graphics.DisplayCondition,boolean)