public class ToggleSwitch extends java.lang.Object implements ICondition, IExecutable, java.lang.Runnable
Modifier | Constructor and Description |
---|---|
protected |
ToggleSwitch(boolean initialValue) |
Modifier and Type | Method and Description |
---|---|
static ToggleSwitch |
create(boolean initialValue)
Creates a new instance with the given initial value.
|
boolean |
equals(java.lang.Object obj) |
void |
execute()
Changes the underlying value from
true to false or from false to true . |
int |
hashCode() |
boolean |
isFalse() |
boolean |
isOff() |
boolean |
isOn() |
boolean |
isTrue()
Returns whether or not the condition is true
|
static ToggleSwitch |
off()
Creates a new instance with initial value
false . |
static ToggleSwitch |
on()
Creates a new instance with initial value
true . |
void |
run()
Changes the underlying value from
true to false or from false to true . |
void |
toggle()
Changes the underlying value from
true to false or from false to true . |
java.lang.String |
toString() |
public static ToggleSwitch create(boolean initialValue)
public static ToggleSwitch on()
true
.public static ToggleSwitch off()
false
.public boolean isTrue()
ICondition
isTrue
in interface ICondition
public boolean isFalse()
public boolean isOn()
public boolean isOff()
public void run()
true
to false
or from false
to true
.run
in interface java.lang.Runnable
public void execute()
true
to false
or from false
to true
.execute
in interface IExecutable
public void toggle()
true
to false
or from false
to true
.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object