Package de.FeatureModellingTool.FeatureModel

Examples of de.FeatureModellingTool.FeatureModel.Feature


            }
        }
    }

    private static void cloneFeatureTree(Feature feature, FeatureEditor featureEditor, FeatureModel featureModel, FeatureModelEditor featureModelEditor, Hashtable<String, String> htNameMap, HashSet<String> hsSubFeatureIDs) {
        Feature newFeature = featureModelEditor.addFeature(feature.getName());
        htNameMap.put(feature.getID(), newFeature.getID());

        featureEditor.setBindingTime(newFeature, feature.getBindingTime());
        featureEditor.setCategory(newFeature, feature.getCategory());
        featureEditor.setDescription(newFeature, feature.getDescription());
        featureEditor.setVariability(newFeature, feature.getVariability());
View Full Code Here


        }

        Figure rSrc = srcFigureMap.get(fSrc.getID());
        Figure rDist = figureMap.get(fDist.getID());
        for (Iterator<Feature> itFeature = features.iterator(); itFeature.hasNext();) {
            Feature feature = itFeature.next();
            Feature newFeature = fmEditor.addFeature(feature.getName());
            fEditor.setBindingTime(newFeature, feature.getBindingTime());
            fEditor.setCategory(newFeature, feature.getCategory());
            fEditor.setVariability(newFeature, feature.getVariability());

            nameMap.put(feature.getID(), newFeature.getID());

            FeatureFigure figDist = new FeatureFigure();
            figDist.setText(feature.getName());
            figDist.setAttribute("id", feature.getID());
            figDist.setAttribute(FeatureProperties.VARIABILITY, feature.getVariability().getName());
            dvDist.add(figDist);

            Figure fOld = srcFigureMap.get(feature.getID());
            figDist.moveBy(rDist.getDisplayBox().x - rSrc.getDisplayBox().x + fOld.getDisplayBox().x, rDist.getDisplayBox().y - rSrc.getDisplayBox().y + fOld.getDisplayBox().y);
            figureMap.put(newFeature.getID(), figDist);
        }

        for (Iterator<FeatureRelation> itRelation = fmSrc.getAllFeatureRelation().values().iterator(); itRelation.hasNext();) {
            FeatureRelation relation = itRelation.next();
            FeatureRelation newRelation = fmEditor.addRelation(relation.getName(), fmDist.getFeature(nameMap.get(relation.getStartFeature().getID())), fmDist.getFeature(nameMap.get(relation.getEndFeature().getID())));
View Full Code Here

        Set<Feature> features = new HashSet<Feature>();
        features.add(fSrc);
        boolean changed = false;
        do {
            for (Iterator<Feature> itFeature = fmSrc.getAllFeature().values().iterator(); itFeature.hasNext();) {
                Feature feature = itFeature.next();
                if (!features.contains(feature) && features.contains(fmSrc.getParentFeature(feature.getID()))) {
                    features.add(feature);
                    changed = true;
                }
            }
            changed = false;
        } while (changed);
        features.remove(fSrc);

//    Hashtable<String , Figure> srcFigureMap = new Hashtable<String , Figure>();
//    for (FigureEnumeration fe=dvSrc.getDrawing().getFigures()
//        ; fe.hasMoreElements() ; ) {
//      Figure figure = fe.nextFigure();
//      srcFigureMap.put((String)figure.getAttribute("id") , figure);
//    }
//
//    Hashtable<String , String> nameMap = new Hashtable<String , String>();
        nameMap.put(fSrc.getID(), fDist.getID());
//    Hashtable<String , Figure> figureMap = new Hashtable<String , Figure>();
        for (FigureEnumeration fe = dvDist.getDrawing().getFigures(); fe.hasMoreElements();) {
            Figure figure = fe.nextFigure();
            if (fDist.getID().equals(figure.getAttribute("id"))) {
                figureMap.put(fDist.getID(), figure);
                break;
            }
        }

//    Figure rSrc = srcFigureMap.get(fSrc.getID());
        Figure rDist = figureMap.get(fDist.getID());
        for (Iterator<Feature> itFeature = features.iterator(); itFeature.hasNext();) {
            Feature feature = itFeature.next();
            Feature newFeature = fmEditor.addFeature(feature.getName());
            fEditor.setBindingTime(newFeature, feature.getBindingTime());
            fEditor.setCategory(newFeature, feature.getCategory());
            fEditor.setVariability(newFeature, feature.getVariability());

            nameMap.put(feature.getID(), newFeature.getID());

            FeatureFigure figDist = new FeatureFigure();
            figDist.setText(feature.getName());
            figDist.setAttribute("id", feature.getID());
            figDist.setAttribute(FeatureProperties.VARIABILITY, feature.getVariability().getName());
            dvDist.add(figDist);

//      Figure fOld = srcFigureMap.get(feature.getID());
//      figDist.moveBy(rDist.getDisplayBox().x - rSrc.getDisplayBox().x + fOld.getDisplayBox().x
//          , rDist.getDisplayBox().y - rSrc.getDisplayBox().y + fOld.getDisplayBox().y);
            figureMap.put(newFeature.getID(), figDist);
        }

            for (Iterator<FeatureRelation> itRelation = fmSrc.getAllFeatureRelation().values().iterator(); itRelation != null && itRelation.hasNext();) {
                FeatureRelation relation = itRelation.next();
                if (!nameMap.containsKey(relation.getStartFeature().getID()) || !nameMap.containsKey(relation.getEndFeature().getID())) {
View Full Code Here

        ArrayList<String> alCount = new ArrayList<String>();
        while (counts.size() > 0) {
            for (Iterator<Entry<String, Integer>> itCount = cloneCount.entrySet().iterator(); itCount.hasNext();) {
                Entry<String, Integer> entry = itCount.next();
                if (!alCount.contains(entry.getKey())) {
                    Feature feature = fmSrc.getFeature(entry.getKey());

                    feature = fmSrc.getParentFeature(feature.getID());
                    while (feature != null) {
                        counts.remove(feature.getID());
                        feature = fmSrc.getParentFeature(feature.getID());
                    }
                }
            }

            alCount.addAll(counts);
View Full Code Here

            }
        }
    }

    public static void cloneThroughPaste(Feature fSrc, FeatureModel fmSrc, ConstraintModel cmSrc, Feature fDist, FeatureModel fmDist, ConstraintModel cmDist, DrawingView dvDist, FeatureModelEditor fmEditor, FeatureEditor fEditor, Hashtable<String, String> nameMap, Hashtable<String, Figure> figureMap) {
        Feature fTarget = fmEditor.addFeature(fSrc.getName());

        FeatureFigure figDist = new FeatureFigure();
        figDist.setText(fTarget.getName());
        figDist.setAttribute("id", fTarget.getID());
        figDist.setAttribute(FeatureProperties.VARIABILITY, fTarget.getVariability().getName());
        dvDist.add(figDist);

        nameMap.put(fSrc.getID(), fTarget.getID());
        figureMap.put(fTarget.getID(), figDist);

        Feature fParent = fmSrc.getParentFeature(fSrc.getID());
        if (fParent != null) {
            for (Iterator<FeatureRelation> itRelation = fSrc.getAllRelatedRelation().iterator(); itRelation.hasNext();) {
                FeatureRelation relation = itRelation.next();
                if (relation.getStartFeature().getID().equals(fParent.getID())) {
                    FeatureRelation newRelation = fmEditor.addRelation(relation.getName(), fDist, fTarget);

                    ConnectionFigure cf = null;
                    if (FeatureRelation.ATTRIBUTE.equals(newRelation.getName())) {
                        AttributeConnection dvc = new AttributeConnection();
View Full Code Here

    gcfDest.setAttribute("bounds" , fSrc.getAttribute("bounds"));
    gcfDest.setAttribute("frameColor" , fSrc.getAttribute("frameColor"));
    gcfDest.moveBy(fSrc.getDisplayBox().x , fSrc.getDisplayBox().y);
   
    for (Iterator<Feature> itFeature=fsSrc.iterator() ; itFeature.hasNext() ; ) {
      Feature f = itFeature.next();
      if (undecidedOnly && !cvSrc.getFinalCustomizationById(f.getID()).equals(Customization.Undecided)) {
        continue;
      }
      gceDest.addFeature(gcDest , f);
     
      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

  public static boolean checkFeatureRelation(FeatureRelation fr , FeatureModelEditor fme , Figure figure , DrawingView dv , CustomizationVersion cv) {
    if (!fr.getName().equals(FeatureRelation.REQUIRE) && !fr.getName().equals(FeatureRelation.EXCLUDE)) {
      return true;
    }
    Feature fStart = fr.getStartFeature();
    Feature fEnd = fr.getEndFeature();
    Customization cStart = cv.getFinalCustomizationById(fStart.getID());
    Customization cEnd = cv.getFinalCustomizationById(fEnd.getID());
   
    if (fr.getName().equals(FeatureRelation.REQUIRE)) {
      if (Customization.Selected.equals(cStart)) {
        if (Customization.Selected.equals(cEnd)) {
          removeFeatureRelation(fr.getID() , fme , figure , dv);
View Full Code Here

    gcf.setAttribute("frameColor" , constraintFigure.getAttribute("frameColor"));
    dv.add(gcf);
    gcf.setDisplayBox(constraintFigure.getDisplayBox());
   
    for (Iterator<Feature> itFeature=features.iterator() ; itFeature.hasNext() ; ) {
      Feature f = itFeature.next();
      gce.addFeature(gcDest , f);
     
      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);
      plcNew.connectStart(gcf.getConnectors()[0]);
      Figure featureFigure = mFigure.get(f.getID());
      plcNew.endPoint(featureFigure.getConnectors()[3].getDisplayBox().x , featureFigure.getConnectors()[3].getDisplayBox().y);
      plcNew.connectEnd(featureFigure.getConnectors()[3]);
     
      dv.add(plcNew);
    }
View Full Code Here

  public static void removeGroupConstraint(GroupConstraint gc , ConstraintModel cm , ConstraintModelEditor cme
      , DrawingView dv , HashMap<String,Figure> mFigure) {
    List<CFRelation> relations = new ArrayList<CFRelation>();
    List<Figure> figures = new ArrayList<Figure>();
    for (Iterator<Feature> itFeature=gc.getFeatureSet().iterator() ; itFeature.hasNext() ; ) {
      Feature f = itFeature.next();
      CFRelation relation = cm.getCFRelation(f , gc , true);
      if (relation==null) {
        relation = cm.getCFRelation(f , gc , false);
      }
      relations.add(relation);
View Full Code Here

  public static void removeGroupConstraintRelations(GroupConstraint gc , ConstraintModel cm , ConstraintModelEditor cme
      , DrawingView dv , HashMap<String,Figure> mFigure , CustomizationVersion cv) {
    List<Feature> features = new ArrayList<Feature>(gc.getFeatureSet());
    for (int i=0 ; i<features.size() ; i++) {
      Feature feature = features.get(i);
      if (!cv.getFinalCustomizationById(feature.getID()).equals(Customization.Undecided)) {
        CFRelation fr = cm.getCFRelation(feature , gc , false);
        Figure figure = mFigure.get(fr.getID());
        dv.remove(figure);
        cme.removeCFRelation(fr.getID());
      }
View Full Code Here

TOP

Related Classes of de.FeatureModellingTool.FeatureModel.Feature

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.