main.java.burlap.debugtools.DebugFlags Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of burlap Show documentation
Show all versions of burlap Show documentation
The Brown-UMBC Reinforcement Learning and Planning (BURLAP) Java code library is for the use and
development of single or multi-agent planning and learning algorithms and domains to accompany them. The library
uses a highly flexible state/observation representation where you define states with your own Java classes, enabling
support for domains that discrete, continuous, relational, or anything else. Planning and learning algorithms range from classic forward search
planning to value-function-based stochastic planning and learning algorithms.
The newest version!
package burlap.debugtools;
import java.util.HashMap;
import java.util.Map;
/**
* A data structure for specifying debug flags that can be accessed and modified from any class
* @author James MacGlashan
*
*/
public class DebugFlags {
/**
* The flags and their values that are set
*/
private static Map flags;
private DebugFlags() {
// do nothing
}
/**
* Creates/sets a debug flag
* @param id the flag identifier
* @param v the value of the flag
*/
public static void setFlag(int id, int v){
if(flags == null){
flags = new HashMap ();
}
flags.put(id, v);
}
/**
* Returns the value for a given flag; 0 if the flag has never been created/set
* @param id the flag identifier
* @return the value of the flag; 0 if the flag has never been created/set
*/
public static int getFlag(int id){
if(flags == null){
flags = new HashMap ();
}
Integer v = flags.get(id);
if(v == null){
flags.put(id, 0);
return 0;
}
return v;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy