/* $Id: Act.java,v 1.147 2006/01/04 23:17:37 rich Exp $ Copyright (c) 1998-2002 Mitsubishi Electric Research Laboratories, Inc. Use of this file and the system it is part of is constrained by the file COPYRIGHT in the root directory of this system. */ package collagen.plan; import java.util.*; import java.lang.reflect.*; import collagen.*; import collagen.infer.*; import collagen.infer.equal.*; import collagen.infer.tms.*; import collagen.discourse.*; import collagen.beans.*; import collagen.beans.ApplicationAdapter.NoAdapterException; import collagen.lang.lib.*; import collagen.lang.*; import com.merl.util.*; import collagen.infer.gloss.*; import collagen.infer.gloss.Slot.*; public interface Act extends Term, Cloneable { boolean isMentionable (); boolean isRemote (); boolean isUnknown (); boolean isTop (); /** * If requiresExplanation return false, then do not start an * interruption or new toplevel goal to explain this act, but simply attach * it to current goal. **/ boolean requiresExplanation (); /** * Tests whether this toplevel goal can be introduced by recognition. * Default true. */ boolean isRecognizableTop(); boolean isShowable (); boolean isTeachable (Plan plan); boolean isRetriable (Plan plan); boolean isOptionalStep (Plan plan); boolean isRepeatableStep (Plan plan); boolean isUnknownRetryStep (Plan plan); /** * If true, then this is goal is stopped whenever it is popped * off the focus stack. * * @see #isInterruptible(Plan, Act) */ boolean isAbandonable (Plan plan); /** * If false, then instead of interrupting this goal with a segment with given * purpose, pop this goal off the stack. Furthermore, note that all the * segments on the stack are potentially interrupted by a given * interruption. Default true. * * @see #isAbandonable(Plan) */ boolean isInterruptible (Plan plan, Act interruption); boolean isStarter (); Boolean isApplicable (); Boolean isAchieved (); Boolean isApplicable (Situation.Literal when); Boolean isAchieved (Situation.Literal when); /** * If this method returns true, then the given plan is not live. * * @param plan is a plan whose purpose is this act */ boolean isBlocked (Plan plan, boolean nearMiss); /** * Tests whether this non-primitive act can be started as a goal, or this * primitive act performed by user or agent, without asking permission. Note * that if this method returns true, it does not mean that this * act should be undertaken or executed now (or ever); it just means that the * given actor does not need to ask permission first. Also, if the plan for * this action is optional, then it is still unknown whether it should be executed. * * @param who * Actor.USER or Actor.AGENTonly * @param plan * plan whose purpose is this act, or null * * @see Act.Base#isAuthorized(Actor.Literal,Plan) for defaults */ boolean isAuthorized (Actor.Literal who, Plan plan); /** * Tests whether this action has been accepted for execution or undertaking * as a goal by given actor or any actor (if who argument is null). * * @see Act.Base#isAccepted(Actor.Literal) for semantics */ boolean isAccepted (Actor.Literal who); boolean isAccepted (); /** * Tests whether this action has been rejected for execution or undertaking * as a goal by given actor or any actor (if who argument is null). * * @see Act.Base#isAccepted(Actor.Literal) for semantics */ boolean isRejected (Actor.Literal who); boolean isRejected (); /** used for maintaining user model **/ java.io.Serializable getTrackingKey (); UserModel.Index getTrackingIndex (Plan plan, boolean isRepeat); /** * Returns an adjustment to be added to priority of * agenda item generated for instance of this act using given * plan. (Default 0) * * @param plan may be null */ float getPriority (Plan plan); Proposition getPreconditions (); Proposition getPostconditions (); Proposition[] getPreconditionsArray (); Proposition[] getPostconditionsArray (); /** * Returns the proposition associated with this act, or null. The semantics * of this proposition depends on the type of act (e.g., see {@link * Propose}). * * @see #setProposition * @see Propositional **/ Proposition getProposition (); /** * Set the proposition associated with this act, or null. The semantics of * this proposition depends on the type of act (e.g., see {@link Propose}). * * @see #getProposition * @see Propositional **/ void setProposition (Proposition proposition); Actor.Who getWho (); Actor.Literal getWhoValue (); Recipe.Name getHow (); Recipe.Name.Literal getHowValue (); boolean matchesIgnoringResults (Act act); boolean isSubsumedBy (Act act); Proposition[] /* or null */ contributes (Plan plan, boolean nearMiss); Proposition[] /* or null */ matches (Plan plan, boolean nearMiss); boolean contributes (Class actType, boolean nearMiss); Class[] getContributes (); /** * This method is called whenever given parent plan acquires given child plan * (whose purpose is this act) as part of discourse interpretation or recipe * instantiation. It is the responsibility of this method to call * addSubplan. */ Elaboration attach (Plan child, Plan parent, Proposition[] bindings); boolean contributesValues (Plan plan, boolean nearMiss); boolean contributesValues (Plan plan, boolean nearMiss, boolean includeWho); /** * Tests whether this act contributes only to live plans in non-near-miss * recognition. Note that even if this method returns false, non-near-miss * plan recognition (see expand() in Library) does * not interpolate from nonLive plans, which means only direct * contribution to nonLive plans is considered., **/ boolean contributesOnlyLive (); /** * This can be overridden for acts without recipes for which there is special * knowledge (e.g., Propose.What for structures). This is only called if * plan.isPlanned() returns false. **/ boolean isComplete (Plan plan, boolean nearMiss); boolean isPathFrom (Library.Path library, Class c, boolean nearMiss); boolean isLivePathFrom (Library.Path library, Class c, boolean nearMiss); int getParameterCount (); Term getParameter (int i); Term[] getParameters (); Term[] getParameterValues (); boolean hasAllParameterValues (); boolean hasAssumedParameterValue (); Term.Slot[] getParameterOps (); void setParameters (Term[] parameters); Term.Slot getParameterSlot (int i); int getResultCount (); Term getResult (int i); Term[] getResults (); Term[] getResultValues (); Term.Slot[] getResultOps (); void setResults (Term[] parameters); Term.Slot getResultSlot (int i); boolean isJoint (); boolean isAgent (); boolean isUser (); boolean isExternal (); boolean isSelf (Actor self); boolean isOther (Actor self); boolean isBargeIn (Actor actor); Act newAct (Term[] parameters, Term[] results, Term[] properties); /** * Returns this act, a copy, or null, depending on the relationship * between the who value of this act and the given who: *