Collection of useful utilities for Java games and apps. A lot of interesting utilities that could maybe still find some use if you work with Java...
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.
mightyutils/src/mightypork/utils/math/constraints/CachedConstraint.java

47 lines
780 B

package mightypork.utils.math.constraints;
import mightypork.utils.interfaces.Pollable;
/**
* Constraint that is cached
*
* @author Ondřej Hruška (MightyPork)
* @param <C> constraint type
*/
public interface CachedConstraint<C> extends Pollable {
/**
* Called after the cache has changed value (and digest).
*/
void onConstraintChanged();
/**
* @return the cached value
*/
C getCacheSource();
/**
* Enable caching & digest caching
*
* @param yes enable caching
*/
void enableCaching(boolean yes);
/**
* @return true if caching is on
*/
boolean isCachingEnabled();
/**
* Update cached value and cached digest (if digest caching is enabled).<br>
* source constraint is polled beforehand.
*/
@Override
void poll();
}