Package jason.asSyntax

Examples of jason.asSyntax.Structure


    this.operatorInstances = new Hashtable<String, OperatorImpl>();
    this.operatorTemplates = new Hashtable<String, OperatorImpl>();
  }
 
  public Operator createOperatorTemplate(String signature, String[] preconds, String[] effects) {
    Structure oper = Structure.parse(signature);
    ArrayList<Proposition> precondProps = new ArrayList<Proposition>(preconds.length);
    ArrayList<Proposition> effectProps = new ArrayList<Proposition>(effects.length);
   
    for (int i = 0; i < preconds.length; i++) {
      PropositionImpl precond = new PropositionImpl(preconds[i]);
View Full Code Here


    if(operatorInstances.containsKey(noopSignature)) {
      return operatorInstances.get(noopSignature);
    } else {
      List<Proposition> precondsEffects = new ArrayList<Proposition>(1);
      precondsEffects.add(proposition);
      Structure signature = Structure.parse(noopSignature);
      OperatorImpl operator = new OperatorImpl(signature, precondsEffects, precondsEffects);
      this.operatorInstances.put(noopSignature, operator);
      return operator;
    }
  }
View Full Code Here

    //If this operator has been used before, retrieve it from the flyweights
    if(operatorInstances.containsKey(operatorSignature)) {
      return operatorInstances.get(operatorSignature);
    } else {
      //Otherwise, we have to create a new one from a template
      Structure signature = Structure.parse(operatorSignature);
      //If a template exists matching the supplied indicator
      if(this.operatorTemplates.containsKey(signature.getPredicateIndicator().toString())) {
        //We get the template
        OperatorImpl template = (OperatorImpl) this.operatorTemplates.get(signature.getPredicateIndicator().toString());
        //And start copying it
        Structure templateSignature = new Structure(template);
        Unifier un = new Unifier();
        //The signature should unify with the template
        if(!un.unifies(signature, templateSignature)) {
          //This should not happen in a properly described domain
          throw new OperatorFactoryException("Failed to unify "+templateSignature+" with operator "+templateSignature+" instantiating "+operatorSignature);
        }
        templateSignature.apply(un);
        PropositionFactory propositionFactory = PropositionFactory.getInstance();
       
        //Then get the preconditions in the template
        List<Proposition> templatePreconds = template.getPreconds();
        List<Proposition> concretePreconds = new ArrayList<Proposition>(templatePreconds.size());
View Full Code Here

            if(!addInstance) continue;
          }
         
          final OperatorImpl copy = (OperatorImpl) operator.clone();
          Structure struct = new Structure(copy.getFunctor());
          for(Term term : termInstances) {
            struct.addTerm(term);
          }
         
          Unifier unifier = new Unifier();
          if(unifier.unifies(copy, struct)) {
            copy.apply(unifier);
View Full Code Here

TOP

Related Classes of jason.asSyntax.Structure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.