blob: 17c5a8e1577e0227130f101c7684351c82bccbce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package bjc.data;
/**
* A stateful holder that swaps between two values of the same type.
*
* @author EVE
*
* @param <E>
* The value stored in the toggle.
*/
public interface Toggle<E> {
/**
* Retrieve the currently-aligned value of this toggle, and swap the value to
* the new one.
*
* @return The previously-aligned value.
*/
E get();
/**
* Retrieve the currently-aligned value without altering the alignment.
*
* @return The currently-aligned value.
*/
E peek();
/**
* Change the alignment of the toggle.
*
* @param isLeft
* Whether the toggle should be left-aligned or not.
*/
void set(boolean isLeft);
}
|