Package de.FeatureModellingTool.FeatureModel

Examples of de.FeatureModellingTool.FeatureModel.Constraint


                    }
                }
            } else if (relationName.equals(CFRelation.PL_Relation)) {//Լ��ģ���ڹ�ϵ�ı䴦��
                if (!oldEFID.equals(newEFID)) {//��ϵ�������˷����仯

                    Constraint c = constraintModel.getConstraint(oldSFID);

                    Feature newF = featureModel.getFeature(newEFID);

                    String relationID = (String) focusConnection.getAttribute("id");
                    CFRelation oldR = constraintModel.getCFRelation(relationID);
                    CFRModifier modifier = oldR.getModifier();
                    boolean isSource = oldR.isSource();
                    constraintModelEditor.removeCFRelation(relationID);

                    //����id��figure��ӳ���
                    if (idToFigureMap != null) {
                        idToFigureMap.remove(relationID, focusConnection);
                    }

                    CFRelation plRelation = plRelation = constraintModelEditor.addCFRelation(relationID, newF, c, isSource, modifier);

                    if (plRelation != null) {
                        focusConnection.setAttribute("id", plRelation.getID());

                        //����id��figure��ӳ���
                        if (idToFigureMap != null) {
                            idToFigureMap.add(plRelation.getID(), focusConnection);
                        }
                    }
                } else if (!oldSFID.equals(newSFID)) { //��ϵ��Լ���˷����仯
                    Constraint cNew = constraintModel.getConstraint(newSFID);

                    Feature newF = featureModel.getFeature(newEFID);

                    String relationID = (String) focusConnection.getAttribute("id");
                    CFRModifier modifier = constraintModel.getCFRelation(relationID).getModifier();
                    constraintModelEditor.removeCFRelation(relationID);

                    //����id��figure��ӳ���
                    if (idToFigureMap != null) {
                        idToFigureMap.remove(relationID, focusConnection);
                    }

                    ConstraintFigure cf = (ConstraintFigure) newStartFigure;
                    CFRelation plRelation = null;

                    if (cf instanceof PLFigure) {
                        int direction = focusConnection.getStartConnector().getDirection();

                        if (direction == Connector.WEST_DIRECTION || direction == Connector.NORTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, true, modifier);
                        } else if (direction == Connector.EAST_DIRECTION || direction == Connector.SOUTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, false, modifier);
                        } else {
                            assert false;
                        }

                    } else if (cf instanceof GroupConstraintFigure) {
                        GroupConstraintFigure gcf = (GroupConstraintFigure) cf;

                        Integer pp = (Integer) gcf.getAttribute(GroupConstraintFigure.PortPosition);
                        int value = pp.intValue();
                        boolean isSource = false;

                        switch (value) {
                            case SwingConstants.NORTH:
                            case SwingConstants.WEST:
                                isSource = true;
                                break;
                            case SwingConstants.EAST:
                            case SwingConstants.SOUTH:
                                isSource = false;
                                break;
                            default:
                                assert false;
                                break;
                        }

                        plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, isSource, modifier);

                    } else if (cf instanceof VPConstraintFigure) {
                        int direction = focusConnection.getStartConnector().getDirection();

                        if (direction == Connector.WEST_DIRECTION || direction == Connector.NORTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, true, modifier);
                        } else if (direction == Connector.EAST_DIRECTION || direction == Connector.SOUTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, false, modifier);
                        } else {
                            assert false;
                        }
                    } else {
                        assert false;
                    }

                    if (plRelation != null) {
                        focusConnection.setAttribute("id", plRelation.getID());

                        //����id��figure��ӳ���
                        if (idToFigureMap != null) {
                            idToFigureMap.add(plRelation.getID(), focusConnection);
                        }
                    }

                } else
                if (oldSFID.equals(newSFID) && (oldStartConnector != focusConnection.getStartConnector())) {//��ϵԼ���˵������ӷ����仯

                    String relationIDOld = (String) focusConnection.getAttribute("id");

                    CFRelation plRelationOld = constraintModel.getCFRelation(relationIDOld);

                    boolean isSource = plRelationOld.isSource();

                    Feature feature = plRelationOld.getFeature();
                    Constraint plc = (Constraint) plRelationOld.getConstraint();

                    CFRModifier modifier = constraintModel.getCFRelation(relationIDOld).getModifier();
                    constraintModelEditor.removeCFRelation(relationIDOld);

                    //����id��figure��ӳ���
View Full Code Here


    }
  }
 
  private void filterFeatures(FeatureModel fm , ConstraintModel cm , Set<Feature> fs) {
    for(Iterator<Constraint> itc=cm.getAllConstraint().values().iterator() ; itc.hasNext() ; ) {
      Constraint con = itc.next();
      ConstraintExplorerCellRenderHelper helper = ConstraintExplorerCellRenderHelperManager.getInstance().getHelper(con);
      fs.addAll(helper.getRelatedFeatures(con));
    }
    if (fm.getAllFeatureRelation()!=null) {
      for (Iterator<FeatureRelation> itRelation=fm.getAllFeatureRelation().values().iterator() ; itRelation.hasNext() ; ) {
View Full Code Here

            FeatureNode root = (FeatureNode) treeTable.getTreeTableModel().getRoot();

            if (propertyName.equals(ConstraintModelProperties.RELATION_ADDED)) {
                //--���������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);
View Full Code Here

                    }
                }
            } else if (relationName.equals(CFRelation.PL_Relation)) {//Լ��ģ���ڹ�ϵ�ı䴦��
                if (!oldEFID.equals(newEFID)) {//��ϵ�������˷����仯

                    Constraint c = constraintModel.getConstraint(oldSFID);

                    Feature newF = featureModel.getFeature(newEFID);

                    String relationID = (String) focusConnection.getAttribute("id");
                    CFRelation oldR = constraintModel.getCFRelation(relationID);
                    CFRModifier modifier = oldR.getModifier();
                    boolean isSource = oldR.isSource();
                    constraintModelEditor.removeCFRelation(relationID);

                    //����id��figure��ӳ���
                    if (idToFigureMap != null) {
                        idToFigureMap.remove(relationID, focusConnection);
                    }

                    CFRelation plRelation = plRelation = constraintModelEditor.addCFRelation(relationID, newF, c, isSource, modifier);

                    if (plRelation != null) {
                        focusConnection.setAttribute("id", plRelation.getID());

                        //����id��figure��ӳ���
                        if (idToFigureMap != null) {
                            idToFigureMap.add(plRelation.getID(), focusConnection);
                        }
                    }
                } else if (!oldSFID.equals(newSFID)) { //��ϵ��Լ���˷����仯
                    Constraint cNew = constraintModel.getConstraint(newSFID);

                    Feature newF = featureModel.getFeature(newEFID);

                    String relationID = (String) focusConnection.getAttribute("id");
                    CFRModifier modifier = constraintModel.getCFRelation(relationID).getModifier();
                    constraintModelEditor.removeCFRelation(relationID);

                    //����id��figure��ӳ���
                    if (idToFigureMap != null) {
                        idToFigureMap.remove(relationID, focusConnection);
                    }

                    ConstraintFigure cf = (ConstraintFigure) newStartFigure;
                    CFRelation plRelation = null;

                    if (cf instanceof PLFigure) {
                        int direction = focusConnection.getStartConnector().getDirection();

                        if (direction == Connector.WEST_DIRECTION || direction == Connector.NORTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, true, modifier);
                        } else if (direction == Connector.EAST_DIRECTION || direction == Connector.SOUTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, false, modifier);
                        } else {
                            assert false;
                        }

                    } else if (cf instanceof GroupConstraintFigure) {
                        GroupConstraintFigure gcf = (GroupConstraintFigure) cf;

                        Integer pp = (Integer) gcf.getAttribute(GroupConstraintFigure.PortPosition);
                        int value = pp.intValue();
                        boolean isSource = false;

                        switch (value) {
                            case SwingConstants.NORTH:
                            case SwingConstants.WEST:
                                isSource = true;
                                break;
                            case SwingConstants.EAST:
                            case SwingConstants.SOUTH:
                                isSource = false;
                                break;
                            default:
                                assert false;
                                break;
                        }

                        plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, isSource, modifier);

                    } else if (cf instanceof VPConstraintFigure) {
                        int direction = focusConnection.getStartConnector().getDirection();

                        if (direction == Connector.WEST_DIRECTION || direction == Connector.NORTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, true, modifier);
                        } else if (direction == Connector.EAST_DIRECTION || direction == Connector.SOUTH_DIRECTION) {
                            plRelation = constraintModelEditor.addCFRelation(relationID, newF, cNew, false, modifier);
                        } else {
                            assert false;
                        }
                    } else {
                        assert false;
                    }

                    if (plRelation != null) {
                        focusConnection.setAttribute("id", plRelation.getID());

                        //����id��figure��ӳ���
                        if (idToFigureMap != null) {
                            idToFigureMap.add(plRelation.getID(), focusConnection);
                        }
                    }

                } else
                if (oldSFID.equals(newSFID) && (oldStartConnector != focusConnection.getStartConnector())) {//��ϵԼ���˵������ӷ����仯

                    String relationIDOld = (String) focusConnection.getAttribute("id");

                    CFRelation plRelationOld = constraintModel.getCFRelation(relationIDOld);

                    boolean isSource = plRelationOld.isSource();

                    Feature feature = plRelationOld.getFeature();
                    Constraint plc = (Constraint) plRelationOld.getConstraint();

                    CFRModifier modifier = constraintModel.getCFRelation(relationIDOld).getModifier();
                    constraintModelEditor.removeCFRelation(relationIDOld);

                    //����id��figure��ӳ���
View Full Code Here

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

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

            FeatureNode root = (FeatureNode) treeTable.getTreeTableModel().getRoot();

            if (propertyName.equals(ConstraintModelProperties.RELATION_ADDED)) {
                //--���������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);
View Full Code Here

      ) {
    mConstraint.putAll(cmDest.getAllConstraint());
    mRelation.putAll(cmDest.getAllCFRelation());
   
    for (Iterator<Constraint> itConstraint=cmDest.getAllConstraint().values().iterator() ; itConstraint.hasNext() ; ) {
      Constraint cSrc = itConstraint.next();
      if (cSrc instanceof GroupConstraint) {
        dupGroupConstraint((GroupConstraint)cSrc , cmSrc , mName , mFeature , mConstraint , mRelation , cmeDest , gceDest);
      } else if (cSrc instanceof CompositeConstraint) {
        dupCompositeConstraint((CompositeConstraint)cSrc , cmSrc , mName , mFeature , mConstraint , mRelation , cmeDest , cceDest);
      } else if (cSrc instanceof VPConstraint) {
View Full Code Here

TOP

Related Classes of de.FeatureModellingTool.FeatureModel.Constraint

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.