Examples of VPConstraint


Examples of de.FeatureModellingTool.FeatureModel.VPConstraint

                //--���������VPConstraint�ϵĹ�ϵ��
                CFRelation relation = (CFRelation) evt.getNewValue();
                Constraint constraint = relation.getConstraint();

                if (constraint instanceof VPConstraint) {
                    VPConstraint vpc = (VPConstraint) constraint;
                    Feature feature = relation.getFeature();
                    FeatureNode featureNode = getTreeNode(root, feature);

                    boolean isSource = relation.isSource();
                    if (isSource) { //--������source��ϵ: ���е�sink��Ϊsource���ӽڵ�
                        Iterator<Feature> it = vpc.getSinkFeatureSet().iterator();
                        while (it.hasNext()) {
                            Feature sink = it.next();
                            FeatureNode child = getTreeNode(root, sink);
                            ///---���û��һ�������ϵ�Ľڵ㣬������һ�������Ľڵ�
                            FeatureNode specNode = featureNode.getSpecilizationNode();
                            if (specNode == null) {
                                specNode = new FeatureNode(context, FeatureNode.NODE_TYPE_SPECILIZATION);
                                //featureNode.add(specNode);
                                treeTableModel.insertNodeInto(specNode, featureNode, featureNode.getChildCount());
                            }
                            //specNode.add(child);
                            treeTableModel.removeNodeFromParent(child);
                            treeTableModel.insertNodeInto(child, specNode, specNode.getChildCount());
                        }
                    } else { //--������sink��ϵ: ������sink��Ϊsource��specNode���ӽڵ�
                        Iterator<Feature> it = vpc.getSourceFeatureSet().iterator();
                        if (it.hasNext()) {
                            Feature source = it.next();
                            FeatureNode parent = getTreeNode(root, source);
                            FeatureNode specNode = parent.getSpecilizationNode();
                            if (specNode == null) {
                                specNode = new FeatureNode(context, FeatureNode.NODE_TYPE_SPECILIZATION);
                                //parent.add(specNode);
                                treeTableModel.insertNodeInto(specNode, parent, parent.getChildCount());
                            }
                            //specNode.add(featureNode);
                            treeTableModel.removeNodeFromParent(featureNode);
                            treeTableModel.insertNodeInto(featureNode, specNode, specNode.getChildCount());
                        }
                    }
                }
            } else if (propertyName.equals(ConstraintModelProperties.RELATION_REMOVED)) {
                //--���������VPConstraint�ϵĹ�ϵ��
                CFRelation relation = (CFRelation) evt.getOldValue();
                Constraint constraint = relation.getConstraint();

                if (constraint instanceof VPConstraint) {
                    VPConstraint vpc = (VPConstraint) constraint;
                    Feature feature = relation.getFeature();
                    FeatureNode featureNode = getTreeNode(root, feature);

                    boolean isSource = relation.isSource();
                    if (isSource) { //--ɾ����source��ϵ: ���е�sink��Ϊ���ڵ㣬��������������Ƿ�ɾ��������ϵ�ڵ�
                        Iterator<Feature> it = vpc.getSinkFeatureSet().iterator();
                        FeatureNode specNode = null;
                        while (it.hasNext()) {
                            Feature sink = it.next();
                            FeatureNode sinkNode = getTreeNode(root, sink);
                            specNode = (FeatureNode) sinkNode.getParent();
View Full Code Here

Examples of de.FeatureModellingTool.FeatureModel.VPConstraint

 
  public static VPConstraint dupVPConstraint(VPConstraint ccSrc , ConstraintModel cmSrc
      , HashMap<String,String> mName , HashMap<String,Feature> mFeature
      , HashMap<String,Constraint> mConstraint , HashMap<String,CFRelation> mRelation
      , ConstraintModelEditor cmeDest , VPConstraintEditor vpceDest) {
    VPConstraint result = cmeDest.addVPConstraint();
    vpceDest.setType(result , ccSrc.getType());

    for (Iterator<Feature> itFeature=(Iterator<Feature>)ccSrc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
      Feature fSrc = itFeature.next();
      Feature fDest = mFeature.get(mName.get(fSrc.getID()));
      vpceDest.addSourceFeature(result , fDest);
     
      CFRelation cfrSrc = cmSrc.getCFRelation(fSrc , ccSrc , true);
      CFRelation cfrDest = cmeDest.addCFRelation(fDest , result , true , cfrSrc.getModifier());
     
      mName.put(cfrSrc.getID() , cfrDest.getID());
      mRelation.put(cfrDest.getID() , cfrDest);
    }
   
    for (Iterator<Feature> itFeature=(Iterator<Feature>)ccSrc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
      Feature fSrc = itFeature.next();
      Feature fDest = mFeature.get(mName.get(fSrc.getID()));
      vpceDest.addSinkFeature(result , fDest);
     
      CFRelation cfrSrc = cmSrc.getCFRelation(fSrc , ccSrc , false);
      CFRelation cfrDest = cmeDest.addCFRelation(fDest , result , false , cfrSrc.getModifier());
     
      mName.put(cfrSrc.getID() , cfrDest.getID());
      mRelation.put(cfrDest.getID() , cfrDest);
    }
   
    mName.put(ccSrc.getID() , result.getID());
    mConstraint.put(result.getID() , result);
   
    return result;
  }
View Full Code Here

Examples of de.FeatureModellingTool.FeatureModel.VPConstraint

                        fig.setAttribute(GroupConstraintFigure.GroupType, value);
                        fig.invalidate();
                    }
                }
            } else if (src instanceof VPConstraint) {
                VPConstraint target = (VPConstraint) src;
                String propertyName = evt.getPropertyName();

                if (propertyName.equals(VPConstraintProperties.TYPE)) {
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    VPConstraintType gType = target.getType();

                    String value = null;

                    if (VPConstraintType.SingleVP.equals(gType)) {
                        value = VPConstraintFigure.Single;
                    } else if (VPConstraintType.MultiVP.equals(gType)) {
                        value = VPConstraintFigure.Multi;
                    } else if (VPConstraintType.AllVP.equals(gType)) {
                        value = VPConstraintFigure.All;
                    }

                    Iterator iterator = set.iterator();
                    while (iterator.hasNext()) {
                        Figure fig = (Figure) iterator.next();
                        fig.setAttribute(VPConstraintFigure.VPType, value);
                        fig.invalidate();
                    }
                }
            } else if (src instanceof CompositeConstraint) {

                CompositeConstraint target = (CompositeConstraint) src;
                String propertyName = evt.getPropertyName();

                if (propertyName.equals(CompositeConstraintProperties.PL_TYPE)) {
                    //find the figure
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    CompositeConstraintType plType = target.getPLType();

                    Integer value = null;

                    if (CompositeConstraintType.L2R_Implication.equals(plType)) {
                        value = PLFigure.L2R_REQUIRE;
                    } else if (CompositeConstraintType.R2L_Implication.equals(plType)) {
                        value = PLFigure.R2L_REQUIRE;
                    } else if (CompositeConstraintType.Mutex.equals(plType)) {
                        value = PLFigure.MUTEX;
                    } else if (CompositeConstraintType.Equivalence.equals(plType)) {
                        value = PLFigure.EQUIVALENCE;
                    }

                    Iterator iterator = set.iterator();
                    while (iterator.hasNext()) {
                        Figure fig = (Figure) iterator.next();
                        fig.setAttribute(PLFigure.PLType, value);
                        fig.invalidate();
                    }
                } else if (propertyName.equals(CompositeConstraintProperties.SOURCE_TYPE)) {
                    //find the figure
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    CompositeConstraintPortType sourceType = target.getSourceType();

                    String value = null;

                    if (CompositeConstraintPortType.Single.equals(sourceType)) {
                        value = PLFigure.Single;
                    } else if (CompositeConstraintPortType.Multi.equals(sourceType)) {
                        value = PLFigure.Multi;
                    } else {
                        value = PLFigure.All;
                    }

                    Iterator iterator = set.iterator();
                    while (iterator.hasNext()) {
                        Figure fig = (Figure) iterator.next();
                        fig.setAttribute(PLFigure.SourceType, value);
                        fig.invalidate();
                    }
                } else if (propertyName.equals(CompositeConstraintProperties.SINK_TYPE)) {
                    //find the figure
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    CompositeConstraintPortType sinkType = target.getSinkType();

                    String value = null;

                    if (CompositeConstraintPortType.Single.equals(sinkType)) {
                        value = PLFigure.Single;
View Full Code Here

Examples of de.FeatureModellingTool.FeatureModel.VPConstraint

                        fig.setAttribute(GroupConstraintFigure.GroupType, value);
                        fig.invalidate();
                    }
                }
            } else if (src instanceof VPConstraint) {
                VPConstraint target = (VPConstraint) src;
                String propertyName = evt.getPropertyName();

                if (propertyName.equals(VPConstraintProperties.TYPE)) {
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    VPConstraintType gType = target.getType();

                    String value = null;

                    if (VPConstraintType.SingleVP.equals(gType)) {
                        value = VPConstraintFigure.Single;
                    } else if (VPConstraintType.MultiVP.equals(gType)) {
                        value = VPConstraintFigure.Multi;
                    } else if (VPConstraintType.AllVP.equals(gType)) {
                        value = VPConstraintFigure.All;
                    }

                    Iterator iterator = set.iterator();
                    while (iterator.hasNext()) {
                        Figure fig = (Figure) iterator.next();
                        fig.setAttribute(VPConstraintFigure.VPType, value);
                        fig.invalidate();
                    }
                }
            } else if (src instanceof CompositeConstraint) {

                CompositeConstraint target = (CompositeConstraint) src;
                String propertyName = evt.getPropertyName();

                if (propertyName.equals(CompositeConstraintProperties.PL_TYPE)) {
                    //find the figure
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    CompositeConstraintType plType = target.getPLType();

                    Integer value = null;

                    if (CompositeConstraintType.L2R_Implication.equals(plType)) {
                        value = PLFigure.L2R_REQUIRE;
                    } else if (CompositeConstraintType.R2L_Implication.equals(plType)) {
                        value = PLFigure.R2L_REQUIRE;
                    } else if (CompositeConstraintType.Mutex.equals(plType)) {
                        value = PLFigure.MUTEX;
                    } else if (CompositeConstraintType.Equivalence.equals(plType)) {
                        value = PLFigure.EQUIVALENCE;
                    }

                    Iterator iterator = set.iterator();
                    while (iterator.hasNext()) {
                        Figure fig = (Figure) iterator.next();
                        fig.setAttribute(PLFigure.PLType, value);
                        fig.invalidate();
                    }
                } else if (propertyName.equals(CompositeConstraintProperties.SOURCE_TYPE)) {
                    //find the figure
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    CompositeConstraintPortType sourceType = target.getSourceType();

                    String value = null;

                    if (CompositeConstraintPortType.Single.equals(sourceType)) {
                        value = PLFigure.Single;
                    } else if (CompositeConstraintPortType.Multi.equals(sourceType)) {
                        value = PLFigure.Multi;
                    } else {
                        value = PLFigure.All;
                    }

                    Iterator iterator = set.iterator();
                    while (iterator.hasNext()) {
                        Figure fig = (Figure) iterator.next();
                        fig.setAttribute(PLFigure.SourceType, value);
                        fig.invalidate();
                    }
                } else if (propertyName.equals(CompositeConstraintProperties.SINK_TYPE)) {
                    //find the figure
                    Set set = idToFigureMap.get(target.getID());
                    if (set == null) return;

                    //update the figure's display

                    CompositeConstraintPortType sinkType = target.getSinkType();

                    String value = null;

                    if (CompositeConstraintPortType.Single.equals(sinkType)) {
                        value = PLFigure.Single;
View Full Code Here

Examples of de.FeatureModellingTool.FeatureModel.VPConstraint

    }
   
    constraints.clear();
    constraints.addAll(constraintModel.getAllVPConstraint().values());
    for (Iterator<VPConstraint> itConstraint = constraints.iterator() ; itConstraint.hasNext() ; ) {
      VPConstraint gc = itConstraint.next();
     
      boolean newFeature = false;
      boolean allNewFeature = true;
      for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
        Feature constraintFeature = itFeature.next();
        if (htNameMap.containsKey(constraintFeature.getID())) {
          newFeature = true;
        } else {
          allNewFeature = false;
        }
      }
      for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
        Feature constraintFeature = itFeature.next();
        if (htNameMap.containsKey(constraintFeature.getID())) {
          newFeature = true;
        } else {
          allNewFeature = false;
        }
      }

      if (newFeature) {
        VPConstraint newConstraint = null;
        if (allNewFeature) {
          newConstraint = constraintModelEditor.addVPConstraint();
          vpConstraintEditor.setType(newConstraint , gc.getType());
          htNameMap.put(gc.getID() , newConstraint.getID());
        } else {
          newConstraint = gc;
        }
       
        for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature constraintFeature = itFeature.next();
          if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
            constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
            vpConstraintEditor.addSourceFeature(newConstraint , constraintFeature);
          }
        }
       
        for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature constraintFeature = itFeature.next();
          if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
            constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
            vpConstraintEditor.addSinkFeature(newConstraint , constraintFeature);
          }
        }
      }
    }
   
    constraints.clear();
    constraints.addAll(constraintModel.getAllCFRelation().values());
    for (Iterator<CFRelation> itConstraint = constraints.iterator() ; itConstraint.hasNext() ; ) {
      CFRelation gc = itConstraint.next();

      boolean newFeature = false;
      Feature cfFeature = gc.getFeature();
      if (htNameMap.containsKey(gc.getFeature().getID())) {
        cfFeature =  featureModel.getFeature(htNameMap.get(gc.getFeature().getID()));
        newFeature = true;
      }
      Constraint cfConstraint = gc.getConstraint();
      if (htNameMap.containsKey(gc.getConstraint().getID())) {
        cfConstraint = constraintModel.getConstraint(htNameMap.get(gc.getConstraint().getID()));
        newFeature = true;
      }
      if (newFeature) {
        CFRelation newConstraint = constraintModelEditor.addCFRelation(cfFeature , cfConstraint , gc.isSource() , gc.getModifier());
        htNameMap.put(gc.getID() , newConstraint.getID());
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.