Package lupos.gui.operatorgraph.visualeditor.visualrif.operators

Examples of lupos.gui.operatorgraph.visualeditor.visualrif.operators.FrameOperator


    System.out.println("visit(RulePredicate obj, Object arg)");
    final LinkedList<Term> terms = new LinkedList<Term>();

    // FrameOperator
    if(obj.getLabel().contains("[") && obj.getLabel().contains("]")){
      final FrameOperator frameOperator = new FrameOperator();
      frameOperator.setVisualRifEditor(this.visualRifEditor);
      frameOperator.setConstantComboBoxEntries(this.comboBoxEntries);
      // create Terms

      switch((Integer) obj.termParams.get(0).accept(this.scout, arg)){
      case Scout.RULEVARIABLE :   if(((String)obj.termParams.get(0).accept(this, arg)).startsWith("ALIASVAR")){
        // TODO: check!
      }
      final Term termVar1 = frameOperator.prepareToCreateVariableTerm((String)obj.termParams.get(0).accept(this, arg));
      terms.add(termVar1);
      break;

      case Scout.CONSTANT: String[] constArray = new String[2];
      constArray = (String[]) obj.termParams.get(0).accept(this, arg);
      final Term termConst1 = frameOperator.prepareToCreateConstantTerm(constArray[0],constArray[1],this.comboBoxEntries);
      terms.add(termConst1);
      break;
      case Scout.RULELIST:
        final ListOperator listOperator = (ListOperator) obj.termParams.get(0).accept(this, arg);
        final Term listTerm = frameOperator.prepareToCreateListTerm(listOperator, this.comboBoxEntries);
        terms.add(listTerm);
        break;
      case Scout.RULEPREDICATE:
        final UnitermOperator unitermOperator = (UnitermOperator) obj.termParams.get(0).accept(this, arg);
        final Term unitermTerm = frameOperator.prepareToCreateUnitermTerm(unitermOperator, this.comboBoxEntries);
        terms.add(unitermTerm);
        break;
      case Scout.EXTERNAL:
        final UnitermOperator external = (UnitermOperator) obj.termParams.get(0).accept(this, arg);
        final Term externalTerm = frameOperator.prepareToCreateUnitermTerm(external, this.comboBoxEntries);
        terms.add(externalTerm);
        break;
      default:
        System.err.println("VisualRifGenerator.visit(RulePredicate obj, Object arg)");//TODO
        break;
      }

      switch((Integer) obj.termName.accept(this.scout, arg)){
      case Scout.RULEVARIABLE :
        final Term termNameVar = frameOperator.prepareToCreateVariableTerm((String)obj.termName.accept(this, arg));
        terms.add(termNameVar);
        break;

      case Scout.CONSTANT:
        String[] constArray = new String[2];
        constArray = (String[]) obj.termName.accept(this, arg);
        final Term termNameConst = frameOperator.prepareToCreateConstantTerm(constArray[0],constArray[1],this.comboBoxEntries);
        terms.add(termNameConst);
        break;

      case Scout.RULELIST:
        final ListOperator listOperator = (ListOperator) obj.termName.accept(this, arg);
        final Term listTerm = frameOperator.prepareToCreateListTerm(listOperator, this.comboBoxEntries);
        terms.add(listTerm);
        break;

      case Scout.RULEPREDICATE:
        final UnitermOperator unitermOperator = (UnitermOperator) obj.termName.accept(this, arg);
        final Term unitermTerm = frameOperator.prepareToCreateUnitermTerm(unitermOperator, this.comboBoxEntries);
        terms.add(unitermTerm);
        break;

      case Scout.EXTERNAL:
        final UnitermOperator external = (UnitermOperator) obj.termName.accept(this, arg);
        final Term externalTerm = frameOperator.prepareToCreateUnitermTerm(external, this.comboBoxEntries);
        terms.add(externalTerm);
        break;

      default:
        System.err.println("VisualRifGenerator.visit(RulePredicate obj, Object arg)");//TODO
        break;
      }

      switch((Integer) obj.termParams.get(1).accept(this.scout, arg)){
      case Scout.RULEVARIABLE :
        final Term termVar2 = frameOperator.prepareToCreateVariableTerm((String)obj.termParams.get(1).accept(this, arg));
        terms.add(termVar2);
        break;

      case Scout.CONSTANT: String[] constArray = new String[2];
        constArray = (String[]) obj.termParams.get(1).accept(this, arg);
        final Term termConst2 = frameOperator.prepareToCreateConstantTerm(constArray[0],constArray[1],this.comboBoxEntries);
        terms.add(termConst2);
        break;

      case Scout.RULELIST:
        final ListOperator listOperator = (ListOperator) obj.termParams.get(1).accept(this, arg);
        final Term listTerm = frameOperator.prepareToCreateListTerm(listOperator, this.comboBoxEntries);
        terms.add(listTerm);
        break;

      case Scout.RULEPREDICATE:
        final UnitermOperator unitermOperator = (UnitermOperator) obj.termParams.get(1).accept(this, arg);
        final Term unitermTerm = frameOperator.prepareToCreateUnitermTerm(unitermOperator, this.comboBoxEntries);
        terms.add(unitermTerm);
        break;

      case Scout.EXTERNAL:
        final UnitermOperator external = (UnitermOperator) obj.termParams.get(1).accept(this, arg);
        final Term externalTerm = frameOperator.prepareToCreateUnitermTerm(external, this.comboBoxEntries);
        terms.add(externalTerm);
        break;

      default:
        System.err.println("VisualRifGenerator.visit(RulePredicate obj, Object arg)");//TODO
        break;
      }
      frameOperator.setTerms(terms);
      if( (arg instanceof RuleGraph) &&((RuleGraph) arg).isRecursiveOperatorGraph()  ){
        System.out.println("!Ich wart hier");
        final RuleGraph rg = ((RuleGraph) arg);
        rg.getOperatorContainer().addOperator(frameOperator);
      }
View Full Code Here


      return listOperator;
    }// End List

    // Frame
    if (left instanceof FrameOperator){
      final FrameOperator frameOperator = (FrameOperator) left;
      switch((Integer) obj.rightExpr.accept(this.scout, arg)){

        case Scout.RULEVARIABLE:
          final VariableOperator varOpR = new VariableOperator();
          varOpR.setVariable((String)right);
          final OperatorIDTuple<Operator> oidtVar = new OperatorIDTuple<Operator> (varOpR, 0);
          frameOperator.addSucceedingOperator(oidtVar);
          break;

        case Scout.CONSTANT:
          final ConstantOperator constOpR = new ConstantOperator();
          constOpR.setVisualRifEditor(this.visualRifEditor);
          constOpR.setComboBoxEntries(this.comboBoxEntries);
          final String[] prefConst = (String[]) obj.rightExpr.accept(this, arg);
          constOpR.setConstant(prefConst[1]);
          constOpR.getConstantComboBox().setSelectedItem(prefConst[0]);
          constOpR.setSelectedPrefix(prefConst[0]);
          final OperatorIDTuple<Operator> oidtConst = new OperatorIDTuple<Operator> (constOpR, 0);
          frameOperator.addSucceedingOperator(oidtConst);
          break;

        case Scout.RULEPREDICATE:
          if(right instanceof UnitermOperator){
            final UnitermOperator factOpR = (UnitermOperator) right;
            final OperatorIDTuple<Operator> oidtRulePred = new OperatorIDTuple<Operator> (factOpR, 0);
            frameOperator.addSucceedingOperator(oidtRulePred);
          }
          break;

        case Scout.EXTERNAL:
          if(right instanceof UnitermOperator){
            final UnitermOperator factOpR = (UnitermOperator) right;
            final OperatorIDTuple<Operator> oidtRulePred = new OperatorIDTuple<Operator> (factOpR, 0);
            frameOperator.addSucceedingOperator(oidtRulePred);
          }
          break;

        case Scout.RULELIST:
          final ListOperator listOpR = (ListOperator) right;
          final OperatorIDTuple<Operator> oidt = new OperatorIDTuple<Operator> (listOpR, 0);
          frameOperator.addSucceedingOperator(oidt);
          break;

        default:
          break;
      }
View Full Code Here

      final ListOperator lo = (ListOperator) newOp;
      this.createNewListOperator(lo);
    }

    if ( newOp instanceof FrameOperator ){
      final FrameOperator fo = (FrameOperator) newOp;
      this.createNewFrameOperator(fo);
    }

    if ( newOp instanceof ConstantOperator ){
      final ConstantOperator co = (ConstantOperator) newOp;
View Full Code Here

      // FrameOperator
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "FrameOperator") && (termsObject != null)) {

        final FrameOperator frameOp = new FrameOperator();
        frameOp.setConstantComboBoxEntries(this.visualRifEditor.getDocumentContainer().getActiveDocument().getDocumentEditorPane().getPrefixList());
        frameOp.setVisualRifEditor(this.visualRifEditor);


        // get savedTerms
        final HashMap<String,Term> unsortedTerms = this.getSavedTerms(termsObject,frameOp);

        // sort terms
        final LinkedList<Term> terms =  this.sortTerms(unsortedTerms);

        frameOp.setTerms(terms);

        op = frameOp;
      } // end FrameOperator

      // AND
View Full Code Here

      opX = uop.getX();
      opY = uop.getY();
      distance = 90;
    }
    if (ato instanceof FrameOperator){
      FrameOperator fo = (FrameOperator) ato;
      FrameOperatorPanel fop = fo.getFrameOperatorPanel();
      width = fop.getWidth();
      height = fop.getHeight();
      opX = fop.getX();
      opY = fop.getY();
      distance = 50;
View Full Code Here

TOP

Related Classes of lupos.gui.operatorgraph.visualeditor.visualrif.operators.FrameOperator

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.