Class MCapability


  • public class MCapability
    extends MElement
    The capability model.
    • Field Detail

      • beliefs

        protected java.util.List<MBelief> beliefs
        The beliefs.
      • goals

        protected java.util.List<MGoal> goals
        The goals.
      • plans

        protected java.util.List<MPlan> plans
        The plans.
      • messages

        protected java.util.List<MMessageEvent> messages
        The message events.
      • services

        protected java.util.List<MServiceCall> services
        The services.
      • configurations

        protected java.util.List<MConfiguration> configurations
        The configurations.
      • beliefreferences

        protected java.util.Map<java.lang.String,​java.lang.String> beliefreferences
        The belief mappings (abstract/reference name -> concrete belief name).
      • resultmappings

        protected java.util.Map<java.lang.String,​java.lang.String> resultmappings
        The result mappings
      • goalreferences

        protected java.util.Map<java.lang.String,​java.lang.String> goalreferences
        The goal mappings (abstract/reference name -> concrete name).
      • eventreferences

        protected java.util.Map<java.lang.String,​java.lang.String> eventreferences
        The event mappings (abstract/reference name -> concrete name).
      • expressionreferences

        protected java.util.Map<java.lang.String,​java.lang.String> expressionreferences
        The expression mappings (abstract/reference name -> concrete name).
      • subcapabilities

        protected java.util.List<MCapabilityReference> subcapabilities
        The subcapabilities.
      • ievents

        protected java.util.List<MInternalEvent> ievents
        The internal events.
      • pubs

        protected java.util.Map<ClassInfo,​java.util.List<Tuple2<MGoal,​java.lang.String>>> pubs
        The goal/service publications.
      • conditions

        protected java.util.List<MCondition> conditions
        The expressions.
    • Constructor Detail

      • MCapability

        public MCapability()
        Bean Constructor.
      • MCapability

        public MCapability​(java.lang.String name)
        Create a capability.
    • Method Detail

      • getBeliefs

        public java.util.List<MBelief> getBeliefs()
        Get the beliefs.
        Returns:
        The beliefs.
      • setBeliefs

        public void setBeliefs​(java.util.List<MBelief> beliefs)
        Set the beliefs.
        Parameters:
        beliefs - The beliefs to set.
      • addBelief

        public void addBelief​(MBelief belief)
        Add a belief.
      • removeBelief

        public void removeBelief​(MBelief belief)
        Remove a belief.
      • hasBelief

        public boolean hasBelief​(java.lang.String name)
        Test if a belief is contained.
      • hasBeliefIgnoreCase

        public java.lang.String hasBeliefIgnoreCase​(java.lang.String name)
        Test if a belief is contained.
        Parameters:
        name - The name.
        Returns:
        The correctly spelled belief name or null.
      • getBelief

        public MBelief getBelief​(java.lang.String name)
        Get a belief.
      • getGoals

        public java.util.List<MGoal> getGoals()
        Get the goals.
        Returns:
        The goals.
      • setGoals

        public void setGoals​(java.util.List<MGoal> goals)
        Set the goals.
        Parameters:
        goals - The goals to set.
      • addGoal

        public void addGoal​(MGoal goal)
        Add a goal.
      • getGoal

        public MGoal getGoal​(java.lang.String name)
        Get the goal for its name.
        Returns:
        The goal.
      • getPlans

        public java.util.List<MPlan> getPlans()
        Get the plans.
        Returns:
        The plans.
      • setPlans

        public void setPlans​(java.util.List<MPlan> plans)
        Set the plans.
        Parameters:
        plans - The plans to set.
      • addPlan

        public void addPlan​(MPlan plan)
        Add a plan.
      • getPlan

        public MPlan getPlan​(java.lang.String name)
        Get the plan for its name.
        Returns:
        The plan.
      • sortPlans

        public void sortPlans​(java.util.Map<java.lang.String,​java.lang.Integer> order,
                              java.lang.ClassLoader cl)
        Sorts plans according to their line numbers in the source to guarantee their natural declaration order.
      • getInternalEvents

        public java.util.List<MInternalEvent> getInternalEvents()
        Get the Internals.
        Returns:
        The Internals.
      • setInternalEvents

        public void setInternalEvents​(java.util.List<MInternalEvent> ievents)
        Set the internal events.
        Parameters:
        ievents - The internal events to set.
      • addInternalEvent

        public void addInternalEvent​(MInternalEvent event)
        Add an internal event.
      • hasInternalEvent

        public boolean hasInternalEvent​(java.lang.String name)
        Test if an internal event is contained.
      • getInternalEvent

        public MInternalEvent getInternalEvent​(java.lang.String name)
        Get an internal event.
      • getMessageEvents

        public java.util.List<MMessageEvent> getMessageEvents()
        Get the messages.
        Returns:
        The messages.
      • setMessageEvents

        public void setMessageEvents​(java.util.List<MMessageEvent> messages)
        Set the messages.
        Parameters:
        messages - The messages to set.
      • addMessageEvent

        public void addMessageEvent​(MMessageEvent message)
        Add a message.
      • hasMessageEvent

        public boolean hasMessageEvent​(java.lang.String name)
        Test if a message is contained.
      • getMessageEvent

        public MMessageEvent getMessageEvent​(java.lang.String name)
        Get a message event. Null if not found.
      • getResolvedGoal

        public MGoal getResolvedGoal​(java.lang.String scope,
                                     java.lang.String name)
        Get a goal by resolved name. Exception if not found. This method is meant handles calls from user code (e.g. createXYZ() in a plan). Internally, all references should be mapped to the correct concrete elements already during loading (e.g. config elements).
        Parameters:
        scope - The local scope.
        name - The name, relative to scope.
      • getResolvedInternalEvent

        public MInternalEvent getResolvedInternalEvent​(java.lang.String scope,
                                                       java.lang.String name)
        Get an internal event by resolved name. Exception if not found. This method is meant handles calls from user code (e.g. createXYZ() in a plan). Internally, all references should be mapped to the correct concrete elements already during loading (e.g. config elements).
        Parameters:
        scope - The local scope.
        name - The name, relative to scope.
      • getResolvedMessageEvent

        public MMessageEvent getResolvedMessageEvent​(java.lang.String scope,
                                                     java.lang.String name)
        Get a message event by resolved name. Exception if not found. This method is meant handles calls from user code (e.g. createXYZ() in a plan). Internally, all references should be mapped to the correct concrete elements already during loading (e.g. config elements).
        Parameters:
        scope - The local scope.
        name - The name, relative to scope.
      • getConfigurations

        public java.util.List<MConfiguration> getConfigurations()
        Get the configurations.
        Returns:
        The configurations.
      • setConfigurations

        public void setConfigurations​(java.util.List<MConfiguration> configurations)
        Set the configurations.
        Parameters:
        configurations - The configurations to set.
      • addConfiguration

        public void addConfiguration​(MConfiguration config)
        Add a configuration.
      • getConfiguration

        public MConfiguration getConfiguration​(java.lang.String name)
        Get the configurations.
        Returns:
        The configurations.
      • getServices

        public java.util.List<MServiceCall> getServices()
        Get the services.
        Returns:
        The services.
      • setServices

        public void setServices​(java.util.List<MServiceCall> services)
        Set the services.
        Parameters:
        services - The services to set.
      • getService

        public MServiceCall getService​(java.lang.String name)
        Get the plan for its name.
        Returns:
        The plan.
      • addservice

        public void addservice​(MServiceCall ser)
        Add a service.
      • getCapabilities

        public java.util.List<MCapabilityReference> getCapabilities()
        Get the sub capabilities.
        Returns:
        The sub capabilities.
      • setCapabilities

        public void setCapabilities​(java.util.List<MCapabilityReference> subcapabilities)
        Set the sub capabilities.
        Parameters:
        subcapabilities - The sub capabilities to set.
      • addCapability

        public void addCapability​(MCapabilityReference subcapability)
        Add a sub capability.
      • getExpressions

        public java.util.List<UnparsedExpression> getExpressions()
        Get the expressions.
        Returns:
        The expressions.
      • setExpressions

        public void setExpressions​(java.util.List<UnparsedExpression> expressions)
        Set the expressions.
        Parameters:
        expressions - The expressions to set.
      • addExpression

        public void addExpression​(UnparsedExpression expression)
        Add a expression.
      • hasExpression

        public boolean hasExpression​(java.lang.String name)
        Test if a expression is contained.
      • getExpression

        public UnparsedExpression getExpression​(java.lang.String name)
        Get a expression.
      • getConditions

        public java.util.List<MCondition> getConditions()
        Get the conditions.
        Returns:
        The conditions.
      • setConditions

        public void setConditions​(java.util.List<MCondition> conditions)
        Set the conditions.
        Parameters:
        conditions - The conditions to set.
      • addCondition

        public void addCondition​(MCondition condition)
        Add a condition.
      • hasCondition

        public boolean hasCondition​(java.lang.String name)
        Test if a condition is contained.
      • getCondition

        public MCondition getCondition​(java.lang.String name)
        Get a condition.
      • getGoalPublications

        public java.util.Map<ClassInfo,​java.util.List<Tuple2<MGoal,​java.lang.String>>> getGoalPublications()
        Get the pubs.
        Returns:
        The pubs
      • setGoalPublications

        public void setGoalPublications​(java.util.Map<ClassInfo,​java.util.List<Tuple2<MGoal,​java.lang.String>>> pubs)
        The pubs to set.
        Parameters:
        pubs - The pubs to set
      • addGoalPublication

        public void addGoalPublication​(ClassInfo ci,
                                       MGoal mgoal,
                                       java.lang.String methodname)
        Add a publication info.
      • getBeliefReferences

        public java.util.Map<java.lang.String,​java.lang.String> getBeliefReferences()
        Get the fully qualified belief references (abstract/reference name -> concrete belief name).
      • addBeliefReference

        public void addBeliefReference​(java.lang.String reference,
                                       java.lang.String concrete)
        Add a belief reference (abstract/reference name -> concrete belief name).
        Parameters:
        reference - The fully qualified abstract / reference belief name.
        concrete - The fully qualified concrete belief name.
      • getResultMappings

        public java.util.Map<java.lang.String,​java.lang.String> getResultMappings()
        Get the result mappings (concrete belief->result name). Note: result mappings are inverse to reference mappings!
      • addResultMapping

        public void addResultMapping​(java.lang.String belief,
                                     java.lang.String result)
        Add a result mapping. Note: result mappings are inverse to reference mappings!
        Parameters:
        belief - The concrete belief name (fully qualified).
        result - The result name.
      • getExpressionReferences

        public java.util.Map<java.lang.String,​java.lang.String> getExpressionReferences()
        Get the fully qualified expression references (abstract/reference name -> concrete expression name).
      • addExpressionReference

        public void addExpressionReference​(java.lang.String reference,
                                           java.lang.String concrete)
        Add a expression reference (abstract/reference name -> concrete expression name).
        Parameters:
        reference - The fully qualified abstract / reference expression name.
        concrete - The fully qualified concrete expression name.
      • getEventReferences

        public java.util.Map<java.lang.String,​java.lang.String> getEventReferences()
        Get the fully qualified event references (abstract/reference name -> concrete event name).
      • addEventReference

        public void addEventReference​(java.lang.String reference,
                                      java.lang.String concrete)
        Add a event reference (abstract/reference name -> concrete event name).
        Parameters:
        reference - The fully qualified abstract / reference event name.
        concrete - The fully qualified concrete event name.
      • getGoalReferences

        public java.util.Map<java.lang.String,​java.lang.String> getGoalReferences()
        Get the fully qualified goal references (abstract/reference name -> concrete goal name).
      • addGoalReference

        public void addGoalReference​(java.lang.String reference,
                                     java.lang.String concrete)
        Add a goal reference (abstract/reference name -> concrete goal name).
        Parameters:
        reference - The fully qualified abstract / reference goal name.
        concrete - The fully qualified concrete goal name.
      • addReference

        protected static java.util.Map<java.lang.String,​java.lang.String> addReference​(java.util.Map<java.lang.String,​java.lang.String> references,
                                                                                             java.lang.String reference,
                                                                                             java.lang.String concrete)
        Add a reference and resolve transitive dependencies.
      • getReferences

        protected static java.util.Map<java.lang.String,​java.lang.String> getReferences​(java.util.Map<java.lang.String,​java.lang.String> references)
        Get references or empty map.