jadex.bridge.CheckedAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-platform-bridge Show documentation
Show all versions of jadex-platform-bridge Show documentation
Jadex bridge is a base package for kernels and platforms, i.e., it is used by both and provides commonly used interfaces and classes for active components and their management.
package jadex.bridge;
/**
* Can be used as external action, which will only be executed when
* isValid() is true. Further, it is guaranteed that cleanup() will
* be executed.
*
* Contract is:
* if(isValid())
* run();
* cleanup();
*/
public abstract class CheckedAction implements Runnable
{
//-------- attributes --------
/** The valid flag. */
protected boolean valid;
//-------- constructors --------
/**
* Create a new action.
*/
public CheckedAction()
{
valid = true;
}
//-------- methods --------
/**
* Cleanup will be executed at the end of the action.
* Override if cleanup actions are necessary.
*/
public void cleanup()
{
}
/**
* Test if the timed object is valid.
* @return True, if entry is valid.
*/
public boolean isValid()
{
return valid;
}
/**
* Set the valid state.
* @valid The valid state.
*/
public void setValid(boolean valid)
{
this.valid = valid;
}
}