You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
626 B
48 lines
626 B
11 years ago
|
package mightypork.util.math.constraints;
|
||
11 years ago
|
|
||
|
|
||
|
import java.util.LinkedHashSet;
|
||
|
import java.util.Set;
|
||
|
|
||
|
|
||
|
/**
|
||
11 years ago
|
* Used to poll a number of {@link Pollable}s
|
||
11 years ago
|
*
|
||
|
* @author MightyPork
|
||
|
*/
|
||
|
public class Poller implements Pollable {
|
||
|
|
||
|
private final Set<Pollable> pollables = new LinkedHashSet<>();
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Add a pollable
|
||
|
*
|
||
|
* @param p pollable
|
||
|
*/
|
||
|
public void add(Pollable p)
|
||
|
{
|
||
|
pollables.add(p);
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Remove a pollalbe
|
||
|
*
|
||
|
* @param p pollable
|
||
|
*/
|
||
|
public void remove(Pollable p)
|
||
|
{
|
||
|
pollables.remove(p);
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public void poll()
|
||
|
{
|
||
|
for (final Pollable p : pollables) {
|
||
|
p.poll();
|
||
|
}
|
||
|
}
|
||
|
}
|