org.javasimon.AbstractSimon Maven / Gradle / Ivy
package org.javasimon;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* AbstractSimon implements basic enable/disable and hierarchy functionality.
* All Simon implementations extend this class.
*
* @author Richard "Virgo" Richter
*/
abstract class AbstractSimon implements Simon {
/** Owning manager of this Simon. */
protected Manager manager;
/** Simon's effective state. */
protected volatile boolean enabled;
/** Timestamp of the first usage. */
protected long firstUsage;
/** Timestamp of the last usage. */
protected long lastUsage;
private final String name;
private SimonState state = SimonState.INHERIT;
private Simon parent;
private final List children = new CopyOnWriteArrayList<>();
private String note;
private AttributesSupport attributesSupport = new AttributesSupport();
private Map