Package de.FeatureModellingTool.FeatureModel

Examples of de.FeatureModellingTool.FeatureModel.CFRModifier


                    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��ӳ���
                    if (idToFigureMap != null) {
                        idToFigureMap.remove(relationIDOld, focusConnection);
View Full Code Here


      if (gc.getType().equals(GroupConstraintType.SingleGroup)) {
        List<Feature> features = new ArrayList<Feature>(gc.getFeatureSet());
        for (int i=0 ; i<features.size() ; i++) {
          for (int j=0 ; j<features.size() ; j++) {
            if (i!=j) {
              CFRModifier c;
              this.graph.addEdge(features.get(i) , cm.getCFRelation(features.get(i),gc,false).getModifier().equals(CFRModifier.Affirmation)
                  , features.get(j) , !cm.getCFRelation(features.get(j),gc,false).getModifier().equals(CFRModifier.Affirmation));
            }
          }
        }
View Full Code Here

                    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��ӳ���
                    if (idToFigureMap != null) {
                        idToFigureMap.remove(relationIDOld, focusConnection);
View Full Code Here

      CFRelation cfrSrc = cmSrc.getCFRelation(f , cSrc , true);
      if (cfrSrc==null) {
        cfrSrc = cmSrc.getCFRelation(f , cSrc , false);
      }
     
      CFRModifier modifier = cfrSrc.getModifier();
      if (revertCFRelation) {
        if (modifier.equals(CFRModifier.Affirmation)) {
          modifier = CFRModifier.Negation;
        } else {
          modifier = CFRModifier.Affirmation;
        }
      }
      CFRelation cfrDest = cmeDest.addCFRelation(f , gcDest , false , modifier);
     
      PLConnection plc = new PLConnection();
      plc.setAttribute("id" , cfrDest.getID());
//      result.setAttribute("frameColor" , cfSrc.getAttribute("frameColor"));
//      plc.setAttribute("type" , cfSrc.getAttribute("type"));
      plc.setAttribute("CFRModifier" , modifier.getName());
      plc.startPoint(gcfDest.getDisplayBox().x , gcfDest.getDisplayBox().y);
      Figure figureSrc = mFigure.get(f.getID());
      plc.endPoint(figureSrc.getDisplayBox().x , figureSrc.getDisplayBox().y);
    }
  }
View Full Code Here

      CFRelation cfrSrc = cm.getCFRelation(f , c , true);
      if (cfrSrc==null) {
        cfrSrc = cm.getCFRelation(f , c , false);
      }
     
      CFRModifier modifier = cfrSrc.getModifier();
      if (revertCFRelation) {
        if (modifier.equals(CFRModifier.Affirmation)) {
          modifier = CFRModifier.Negation;
        } else {
          modifier = CFRModifier.Affirmation;
        }
      }
      CFRelation cfrDest = cme.addCFRelation(f , gcDest , false , modifier);
      PLConnection plcOld = (PLConnection)mFigure.get(cfrSrc.getID());
     
     
      PLConnection plcNew = new PLConnection();
      plcNew.setAttribute("id" , cfrDest.getID());
      plcNew.setAttribute("frameColor" , plcOld.getAttribute("frameColor"));
      plcNew.setAttribute("type" , plcOld.getAttribute("type"));
      plcNew.setAttribute("CFRModifier" , modifier.getName());
     
      for (int i=0 ; i<plcOld.pointCount() ; i++) {
        plcNew.addPoint(plcOld.pointAt(i).x , plcOld.pointAt(i).y);
      }
      plcNew.startPoint(gcf.getConnectors()[0].getDisplayBox().x , gcf.getConnectors()[0].getDisplayBox().y);
View Full Code Here

TOP

Related Classes of de.FeatureModellingTool.FeatureModel.CFRModifier

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.