public class SwarmAction extends AbstractWaspAction
Action
class based on int values to speed up inheritance checking. Each action
is assigned a power of 2 int value. Bitwise or checks provide the imply logic. These actions are
instantiated by an ActionFactory
which provides both the name and the int value for the
constructor.Action
Modifier | Constructor and Description |
---|---|
protected |
SwarmAction(int action,
String name,
Object key)
The default constructor for actions.
|
Modifier and Type | Method and Description |
---|---|
int |
actions()
Returns the internal representation of this action.
|
WaspAction |
add(int otherActions)
Creates a new
WaspAction containing both the specified actions and the actions of
this WaspAction . |
SwarmAction |
add(WaspAction other)
Creates a new
WaspAction containing both the specified actions and the actions of
this WaspAction . |
boolean |
equals(Object obj)
Any SwarmAction is equal to another if there 'actions' value is the same.
|
ActionFactory |
getActionFactory()
The actionFactory that created this action.
|
int |
hashCode() |
boolean |
implies(int otherActions)
Check if the supplied actions are implied (bitwise or) by this SwarmAction.
|
boolean |
implies(WaspAction other)
Check if the supplied action is implied (bitwise or) by this SwarmAction.
|
SwarmAction |
remove(int otherActions)
Creates a new
WaspAction with all the actions of this action except those specified. |
WaspAction |
remove(WaspAction action)
Creates a new WaspAction with all the actions of this action except those specified.
|
getName
protected SwarmAction(int action, String name, Object key)
Access
), like Render
.action
- a power of 2 which provides the base value for this actionname
- the name of the actionkey
- the key used to register the owning ActionFactory
with the Actions
objectpublic final boolean implies(int otherActions)
otherActions
- internal value of some other action(s)public final int actions()
public final boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
,
actions()
public final int hashCode()
hashCode
in class Object
Object.hashCode()
public final boolean implies(WaspAction other)
other
- the other actionpublic final WaspAction add(int otherActions)
WaspAction
containing both the specified actions and the actions of
this WaspAction
. This method always returns a new SwarmAction.otherActions
- the actions to addpublic final SwarmAction add(WaspAction other)
WaspAction
containing both the specified actions and the actions of
this WaspAction
. This method always returns a new SwarmAction.other
- the other action(s)public final SwarmAction remove(int otherActions)
WaspAction
with all the actions of this action except those specified.otherActions
- the actions to removepublic final WaspAction remove(WaspAction action)
action
- the actions to removepublic final ActionFactory getActionFactory()
WaspAction
WaspAction.getActionFactory()
Copyright © 2015. All rights reserved.