package com.nailabs.abac.trust; import java.util.*; /** Simple structure for representing the completion state of a linking goal */ public class CompletionState extends Observable { /** * A node is complete when all of its children have either succeeded * or failed completion states (one state per linking solution child). * @see SatisfactionState.SATISFIED * @see SatisfactionState.FAILED * */ public static final String COMPLETE = "complete"; /** * A node is complete while any of its linking solution children have an * unknown satisfaction state. * @see SatisfactionState.UNKNOWN */ public static final String INCOMPLETE = "incomplete"; /** encapsulated completion state */ private String state = INCOMPLETE; /** default constructor */ public CompletionState() { } /** explicit state constructor */ public CompletionState(boolean flag) { state = (flag)? COMPLETE: INCOMPLETE; } /** accessor method for the completion state field */ public boolean isComplete() { return state.equals(COMPLETE); } /** modifier method for the completion state field */ public void setComplete(boolean flag) { state = (flag)? COMPLETE: INCOMPLETE; setChanged(); notifyObservers(); } }