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

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


    final Object right = obj.rightExpr.accept(this, arg);

    // Constant
    if (left instanceof String[]){
      final String[] constArray = (String[])left;
      final ConstantOperator constOpL = new ConstantOperator();
      constOpL.setConstant(constArray[1]);
      constOpL.setComboBoxEntries(this.comboBoxEntries);
      constOpL.setVisualRifEditor(this.visualRifEditor);
      constOpL.getConstantComboBox().setSelectedItem(constArray[0]);
      constOpL.setSelectedPrefix(constArray[0]);

      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);
          constOpL.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);
          constOpL.addSucceedingOperator(oidtConst);
          break;

        case Scout.RULEPREDICATE:
          if(right instanceof UnitermOperator){
            final UnitermOperator factOpR = (UnitermOperator) right;

            final OperatorIDTuple<Operator> oidtRulePred = new OperatorIDTuple<Operator> (factOpR, 0);
            constOpL.addSucceedingOperator(oidtRulePred);
          }
          break;

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

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

        default:
          break;
      }
      return constOpL;
    } // End Constant
    // Variable
    if (left instanceof String){

      final VariableOperator varOpL = new VariableOperator();
      varOpL.setVariable((String)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);
          varOpL.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);
          varOpL.addSucceedingOperator(oidtConst);
          break;

        case Scout.RULEPREDICATE:
          if(right instanceof UnitermOperator){
            final UnitermOperator factOpR = (UnitermOperator) right;

            final OperatorIDTuple<Operator> oidtRulePred = new OperatorIDTuple<Operator> (factOpR, 0);
            varOpL.addSucceedingOperator(oidtRulePred);
          }
          break;

        case Scout.EXTERNAL:
          if(right instanceof UnitermOperator){
            final UnitermOperator factOpR = (UnitermOperator) right;

            final OperatorIDTuple<Operator> oidtRulePred = new OperatorIDTuple<Operator> (factOpR, 0);
            varOpL.addSucceedingOperator(oidtRulePred);
          }
          break;

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

        default:
          break;
      }
      return varOpL;
    }// End Variable

    // Uniterm
    if (left instanceof UnitermOperator){
      final UnitermOperator unitermOperator = (UnitermOperator) 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);
          unitermOperator.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);
          unitermOperator.addSucceedingOperator(oidtConst);
          break;

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

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

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

        default:
          break;
      }
      return unitermOperator;
    }// End Uniterm

    // List
    if (left instanceof ListOperator){
      final ListOperator listOperator = (ListOperator) 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);
          listOperator.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);
          listOperator.addSucceedingOperator(oidtConst);
          break;

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

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

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

        default:
          break;
      }

      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:
View Full Code Here


          left = varOp;
        }

        // linke Seite hat nur eine Konstante
        if (left instanceof String[]){
          final ConstantOperator constOp = new ConstantOperator();
          constOp.setVisualRifEditor(this.visualRifEditor);
          final String[] prefConst = (String[]) left;
          final String[] constantArray = new String[prefConst.length-2];

          for (int i = 0; i < constantArray.length; i++) {
            constantArray[i] = prefConst[i+2];
          }

          constOp.setComboBoxEntries(constantArray);
          constOp.setSelectedPrefix(prefConst[0]);
          constOp.getConstantComboBox().setSelectedItem(prefConst[0]);
          constOp.setConstant(prefConst[1]);
          left = constOp;
        }


        Object right = unVisitedObject.getBody().accept(vrg, this.ruleGraphRight);

        if (right instanceof String){
          final VariableOperator varOp = new VariableOperator();
          varOp.setVariable((String)right);
          right = varOp;
        }
        if (right instanceof String[]){
          final ConstantOperator constOp = new ConstantOperator();
          constOp.setVisualRifEditor(this.visualRifEditor);
          final String[] prefConst = (String[]) right;
          final String[] constantArray = new String[prefConst.length-2];

          for (int i = 0; i < constantArray.length; i++) {
            constantArray[i] = prefConst[i+2];
          }

          constOp.setComboBoxEntries(constantArray);
          constOp.setSelectedPrefix(prefConst[0]);
          constOp.getConstantComboBox().setSelectedItem(prefConst[0]);
          constOp.setConstant(prefConst[1]);
          right = constOp;
        }
        // List
        if ( left instanceof AbstractTermOperator ){
          final AbstractTermOperator abstractTermOperator = (AbstractTermOperator) left;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(abstractTermOperator);
          rootListLeft.add(gwo);
        }

        if ( right instanceof AbstractTermOperator ){
          final AbstractTermOperator abstractTermOperator = (AbstractTermOperator) right;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(abstractTermOperator);
          rootListRight.add(gwo);
        }
//        // Uniterm
//        if ( left instanceof UnitermOperator ){
//          UnitermOperator unitermOperator = (UnitermOperator) left;
//          GraphWrapperOperator gwo = new GraphWrapperOperator(unitermOperator);
//          rootListLeft.add(gwo);
//        }
//
//        if ( right instanceof UnitermOperator ){
//          UnitermOperator unitermOperator = (UnitermOperator) right;
//          GraphWrapperOperator gwo = new GraphWrapperOperator(unitermOperator);
//          rootListRight.add(gwo);
//        }
//
//        // Frame
//        if ( left instanceof FrameOperator ){
//          FrameOperator frameOperator = (FrameOperator) left;
//          GraphWrapperOperator gwo = new GraphWrapperOperator(frameOperator);
//          rootListLeft.add(gwo);
//        }
//
//        if ( right instanceof FrameOperator ){
//          FrameOperator frameOperator = (FrameOperator) right;
//          GraphWrapperOperator gwo = new GraphWrapperOperator(frameOperator);
//          rootListRight.add(gwo);
//        }
//        // List
//        if ( left instanceof ListOperator ){
//          ListOperator listOperator = (ListOperator) left;
//          GraphWrapperOperator gwo = new GraphWrapperOperator(listOperator);
//          rootListLeft.add(gwo);
//        }
//
//        if ( right instanceof ListOperator ){
//          ListOperator listOperator = (ListOperator) right;
//          GraphWrapperOperator gwo = new GraphWrapperOperator(listOperator);
//          rootListRight.add(gwo);
//        }

        // And
        if ( left instanceof AndContainer ){
          final AndContainer andContainer = (AndContainer) left;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(andContainer);
          rootListLeft.add(gwo);
        }

        if ( right instanceof AndContainer ){
          final AndContainer andContainer = (AndContainer) right;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(andContainer);
          rootListRight.add(gwo);
        }

        // OR
        if ( right instanceof OrContainer ){
          final OrContainer orContainer = (OrContainer) right;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(orContainer);
          rootListRight.add(gwo);
        }

        // Exists
        if ( right instanceof ExistsContainer ){
          final ExistsContainer existsContainer = (ExistsContainer) right;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(existsContainer);
          rootListRight.add(gwo);
        }


        // Variable
        if ( left instanceof VariableOperator ){
          final VariableOperator variableOperator = (VariableOperator) left;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(variableOperator);
          rootListLeft.add(gwo);
        }

        if ( right instanceof VariableOperator ){
          final VariableOperator variableOperator = (VariableOperator) right;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(variableOperator);
          rootListRight.add(gwo);
        }

        // Constant
        if ( left instanceof ConstantOperator ){
          final ConstantOperator constantOperator = (ConstantOperator) left;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(constantOperator);
          rootListLeft.add(gwo);
        }

        if ( right instanceof ConstantOperator ){
          final ConstantOperator constantOperator = (ConstantOperator) right;
          final GraphWrapperOperator gwo = new GraphWrapperOperator(constantOperator);
          rootListRight.add(gwo);
        }

      // generate Left QueryGraph...
View Full Code Here

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

    if ( newOp instanceof ConstantOperator ){
      final ConstantOperator co = (ConstantOperator) newOp;
      this.createNewConstantOperator(co);
    }

    if ( newOp instanceof VariableOperator ){
      final VariableOperator vo = (VariableOperator) newOp;
View Full Code Here

        }
      }

      // Constant
      if (op instanceof ConstantOperator) {
        final ConstantOperator co = (ConstantOperator) op;
        if (!co.isChild()) {
          try {
            saveObject.put(this.checkName("ConstantOperator",
                "ConstantOperator", 0), co.toJSON());
          } catch (final JSONException e) {
            e.printStackTrace();
          }
        }
      }
View Full Code Here

    } // End Variable to Variable

    // Constant to Constant
    if ( (parentOp instanceof ConstantOperator) && (childOp instanceof ConstantOperator) ) {

      final ConstantOperator parentCO = ( ConstantOperator ) parentOp;
      final ConstantOperator childCO = ( ConstantOperator ) childOp;

      this.setConstantOperator(parentCO);
      this.parentOp = parentCO;
      this.child = childCO;
      this.setConstant(true);
      this.init();

    } // End Constant to Constant

    // Constant to Variable
    if ( (parentOp instanceof ConstantOperator) && (childOp instanceof VariableOperator) ) {

      final ConstantOperator parentCO = ( ConstantOperator ) parentOp;
      final VariableOperator childVO = ( VariableOperator ) childOp;

      this.setConstantOperator(parentCO);
      this.parentOp = parentCO;
      this.child = childVO;
      this.setConstant(true);
      this.init();

    } // End Constant to Constant

    // Variable to Constant
    if ( (parentOp instanceof VariableOperator) && (childOp instanceof ConstantOperator) ) {

      final VariableOperator parentVO = ( VariableOperator ) parentOp;
      final ConstantOperator childCO = ( ConstantOperator ) childOp;

      this.setVariableOperator(parentVO);
      this.parentOp = parentVO;
      this.child = childCO;
      this.setVariable(true);
      this.init();

    } // End Variable to Constant

    // Uniterm to Uniterm
    if ( (parentOp instanceof UnitermOperator) && (childOp instanceof UnitermOperator) ) {

      final UnitermOperator parentFO = ( UnitermOperator ) parentOp;
      final UnitermOperator childFO = ( UnitermOperator ) childOp;

      this.setUnitermOperator(parentFO);
      this.parentOp = parentFO;
      this.child = childFO;
      this.setUniterm(true);
      this.init();

    } // End Uniterm to Uniterm

    // Uniterm to Constant
    if ( (parentOp instanceof UnitermOperator) && (childOp instanceof ConstantOperator) ) {

      final UnitermOperator parentFO = ( UnitermOperator ) parentOp;
      final ConstantOperator childCO = ( ConstantOperator ) childOp;

      this.setUnitermOperator(parentFO);
      this.parentOp = parentFO;
      this.child = childCO;
      this.setUniterm(true);
      this.init();

    } // End Uniterm to Constant

    // Constant to Uniterm
    if ( (parentOp instanceof ConstantOperator) && (childOp instanceof UnitermOperator) ) {

      final ConstantOperator parentCO = ( ConstantOperator ) parentOp;
      final UnitermOperator childFO = ( UnitermOperator ) childOp;

      this.setConstantOperator(parentCO);
      this.parentOp = parentCO;
      this.child = childFO;
      this.setConstant(true);
      this.init();

    } // End Constant to Uniterm

    // Uniterm to Variable
    if ( (parentOp instanceof UnitermOperator) && (childOp instanceof VariableOperator) ) {

      final UnitermOperator parentFO = ( UnitermOperator ) parentOp;
      final VariableOperator childVO = ( VariableOperator ) childOp;

      this.setUnitermOperator(parentFO);
      this.parentOp = parentFO;
      this.child = childVO;
      this.setUniterm(true);
      this.init();

      } // End Uniterm to Variable

    // Variable to Uniterm
    if ( (parentOp instanceof VariableOperator) && (childOp instanceof UnitermOperator) ) {

      final VariableOperator parentVO = ( VariableOperator ) parentOp;
      final UnitermOperator childFO = ( UnitermOperator ) childOp;

      this.setVariableOperator(parentVO);
      this.parentOp = parentVO;
      this.child = childFO;
      this.setVariable(true);
      this.init();

      } // End Variable to Uniterm

    // Variable to List
    if ( (parentOp instanceof VariableOperator) && (childOp instanceof ListOperator) ) {

      final VariableOperator parentVO = ( VariableOperator ) parentOp;
      final ListOperator childLO = ( ListOperator ) childOp;

      this.setVariableOperator(parentVO);
      this.parentOp = parentVO;
      this.child = childLO;
      this.setVariable(true);
      this.init();

      }
    // End Variable to List

    // List to Variable
    if ( (parentOp instanceof ListOperator) && (childOp instanceof VariableOperator) ) {

      final ListOperator parentLO = ( ListOperator ) parentOp;
      final VariableOperator childVO = ( VariableOperator ) childOp;

      this.setListOperator(parentLO);
      this.parentOp = parentLO;
      this.child = childVO;
      this.setList(true);
      this.init();

    }
    // End List to Variable

    // Constant to List
    if ( (parentOp instanceof ConstantOperator) && (childOp instanceof ListOperator) ) {

      final ConstantOperator parentCO = ( ConstantOperator ) parentOp;
      final ListOperator childLO = ( ListOperator ) childOp;

      this.setConstantOperator(parentCO);
      this.parentOp = parentCO;
      this.child = childLO;
      this.setConstant(true);
      this.init();

    }
    // End Constant to List

    // List to Constant
    if ( (parentOp instanceof ListOperator) && (childOp instanceof ConstantOperator) ) {

      final ListOperator parentLO = ( ListOperator ) parentOp;
      final ConstantOperator childCO = ( ConstantOperator ) childOp;

      this.setListOperator(parentLO);
      this.parentOp = parentLO;
      this.child = childCO;
      this.setList(true);
View Full Code Here

      // Constant
      if (operatorObject.has("OP TYPE")
          && operatorObject.getString("OP TYPE").equals(
              "ConstantOperator")) {
        final ConstantOperator constantOperator = new ConstantOperator();
        constantOperator.setVisualRifEditor(this.visualRifEditor);
        constantOperator.fromJSON(operatorObject, constantOperator, this);
        op = constantOperator;
      }

      System.out.println(operatorObject.getString("OP TYPE"));
      final JSONArray positionArray = operatorObject.getJSONArray("POSITION");
View Full Code Here

    if ( this.isVariable() ){
      final VariableOperator vp = ( VariableOperator ) this.parentOp;
      vp.setSelectedClassification(selectedClassification);
    }
    if ( this.isConstant() ){
      final ConstantOperator cp = ( ConstantOperator ) this.parentOp;
      cp.setSelectedClassification(selectedClassification);
    }
    if ( this.isUniterm() ){
      final UnitermOperator fp = ( UnitermOperator ) this.parentOp;
      fp.setSelectedClassification(selectedClassification);
    }
View Full Code Here

TOP

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

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.