Package de.FeatureModellingTool.FeatureModel

Examples of de.FeatureModellingTool.FeatureModel.Feature


    }
    fs.addAll(parents);
  }
 
  private void filterFeatures(FeatureModel fm , Feature feature , Set<Feature> parents) {
    Feature fParent = fm.getParentFeature(feature.getID());
    if (fParent!=null) {
      parents.add(fParent);
      filterFeatures(fm , fParent , parents);
    }
  }
View Full Code Here


                    return;
                }

            }

            Feature feature = null;
            ResourceComponent rc = null;

            feature = featureModel.getFeature(id);
            if (feature == null)
                rc = interactionModel.getResourceComponent(id);


            if ((feature == null) && (rc == null)) {
                dtde.dropComplete(false);
                return;
            }

            dtde.dropComplete(true);

            DropTarget dropTarget = (DropTarget) dtde.getSource();

            DrawingView drawingView = (DrawingView) dropTarget.getComponent();

            if (feature != null) {
                FeatureFigure ff = new FeatureFigure();
                ff.setAttribute("id", id);
                ff.setAttribute(FeatureFigure.IS_A_LINK, Boolean.TRUE);
                ff.setAttribute("text", feature.getName());
                ff.setAttribute(FeatureProperties.VARIABILITY, feature.getVariability().getName());
                ff.setAttribute(FeatureProperties.BINDINGTIME, feature.getBindingTime().getName());

                Point location = dtde.getLocation();
                double scale = drawingView.getScale();
                int realX = (int) (location.getX() / scale + 0.5);
                int realY = (int) (location.getY() / scale + 0.5);
View Full Code Here

  public static boolean removeUnselectedFeature(FeatureModel fm , FeatureModelEditor fme , CustomizationVersion cv
      , HashMap<String,Figure> mFigure , HashMap<Figure,DrawingView> mDrawingView) {
    List<Feature> features = new ArrayList<Feature>(fm.getAllFeature().values());
    HashSet<Feature> removeFeatures = new HashSet<Feature>();
    for (int i=0 ; i<features.size() ; i++) {
      Feature feature = features.get(i);
      if (Customization.Unselected.equals(cv.getFinalCustomizationById(feature.getID()))) {
        removeFeatures.add(feature);
      }
    }
    if (fm.getAllFeatureRelation()!=null) {
      List<FeatureRelation> relations = new ArrayList<FeatureRelation>(fm.getAllFeatureRelation().values());
      for (int i=relations.size()-1 ; i>=0 ; i--) {
        FeatureRelation relation = relations.get(i);
        if (removeFeatures.contains(relation.getStartFeature()) || removeFeatures.contains(relation.getEndFeature())) {
          Figure f = mFigure.get(relation.getID());
          DrawingView dv = mDrawingView.get(f);
         
          dv.remove(f);
          fme.removeRelation(relation);
        }
      }
    }
   
    for (int i=0 ; i<features.size() ; i++) {
      Feature feature = features.get(i);
      if (removeFeatures.contains(feature)) {
        Figure f = mFigure.get(feature.getID());
        DrawingView dv = mDrawingView.get(f);
       
        dv.remove(f);
        fme.removeFeature(feature);
      }
View Full Code Here

 
  public static boolean updateSelectedFeature(FeatureModel fm , FeatureEditor fe , CustomizationVersion cv
      , HashMap<String,Figure> mFigure) {
    List<Feature> features = new ArrayList<Feature>(fm.getAllFeature().values());
    for (int i=0 ; i<features.size() ; i++) {
      Feature feature = features.get(i);
      if (Customization.Selected.equals(cv.getFinalCustomizationById(feature.getID()))) {
        fe.setVariability(feature , Variability.Mandatory);
        Figure figure = mFigure.get(feature.getID());
        figure.setAttribute(FeatureProperties.VARIABILITY , feature.getVariability().getName());
      }
    }
   
    return true;
  }
View Full Code Here

            super.mouseDown(e, x, y);

            //�� feature model ���������
            String name = (String) createdFigure.getAttribute(FeatureFigure.TEXT);
            if (name == null) name = "";
            Feature currentFeature = featureModelEditor.addFeature(name);
            createdFigure.setAttribute("id", currentFeature.getID());

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

            drawingView.checkDamage();
            textHolder = (TextHolder) createdFigure;
            beginEdit(textHolder);
View Full Code Here

     */
    protected void updateFeatureName() {
        if ((getTypingTarget() != null) && (fTextField != null)) {
            Figure figure = (Figure) getTypingTarget();
            String id = (String) figure.getAttribute("id");
            Feature feature = featureModel.getFeature(id);
            this.featureEditor.setName(feature, getTypingTarget().getText());
        }
    }
View Full Code Here

  }
 
  List<FeatureNode> listNode = new ArrayList<FeatureNode>();
  Iterator<Feature> it = listFeature.iterator();
  while (it.hasNext()) {
      Feature _feature = it.next();
      FeatureNode node = new FeatureNode(context, _feature);
      listNode.add(node);
  }
  return listNode; 
    }
View Full Code Here

            refineRelation.put(FeatureRelation.ATTRIBUTE, "attribute");

            Object evtSource = evt.getSource();

            if (Feature.class.isInstance(evtSource)) {
                Feature feature = (Feature) evtSource;
                FeatureNode featureNode = getTreeNode(root, feature);
                treeTable.repaint();
            } else if (FeatureModel.class.isInstance(evtSource)) {
                if (propertyName.equals(FeatureModelProperties.FEATURE_ADDED)) {
                    Feature feature = (Feature) evt.getNewValue();
                    FeatureNode featureNode = new FeatureNode(context, feature);
                    //root.add(featureNode);
                    treeTableModel.insertNodeInto(featureNode, root, root.getChildCount());
                } else if (propertyName.equals(FeatureModelProperties.FEATURE_REMOVED)) {
                    //--ɾ��һ���ڵ㣺�Ӹ��ڵ���ɾ���ýڵ㣬�����ýڵ�������ӽڵ���Ϊ���ڵ�
                    ///---�����ڵ㣨��ϵ�ڵ㣩���ٰ��������ڵ㣬��ɾ�����ڵ�
                    Feature feature = (Feature) evt.getOldValue();
                    FeatureNode featureNode = getTreeNode(root, feature);
                    FeatureNode parent = (FeatureNode) featureNode.getParent();

                    //int index = parent.getIndex(featureNode);
                    //parent.remove(featureNode);
                    treeTableModel.removeNodeFromParent(featureNode);

                    List<FeatureNode> children = new ArrayList<FeatureNode>();
                    Enumeration e = featureNode.children();
                    while (e.hasMoreElements()) { //--���������ォchild��ӵ�root,�������޸�e��ʹ�ñ����������ȷ
                        FeatureNode child = (FeatureNode) e.nextElement();
                        children.add(child);
                    }
                    Iterator<FeatureNode> it = children.iterator();
                    while (it.hasNext()) {
                        FeatureNode child = it.next();
                        //root.add(child);
                        treeTableModel.insertNodeInto(child, root, root.getChildCount());
                    }

                    boolean bHasMoreChildren = parent.children().hasMoreElements();
                    if (!bHasMoreChildren) {
                        //FeatureNode grandParent = (FeatureNode) parent.getParent();
                        //grandParent.remove(parent);
                        treeTableModel.removeNodeFromParent(parent);
                    }
                } else if (propertyName.equals(FeatureModelProperties.RELATION_ADDED)) {
                    //--��������˾�����ϵ����endNode��ΪstartNode�����ӽڵ㣬�м���Ϲ�ϵ�ڵ�
                    FeatureRelation fr = (FeatureRelation) evt.getNewValue();
                    String relationName = fr.getName();

                    if (refineRelation.containsKey(relationName)) {
                        Feature start = fr.getStartFeature();
                        Feature end = fr.getEndFeature();
                        FeatureNode startNode = getTreeNode(root, start);
                        FeatureNode endNode = getTreeNode(root, end);

                        if (relationName.equals(FeatureRelation.DECOMPOSE)) {
                            FeatureNode compNode = startNode.getCompositionNode();
                            if (compNode == null) {
                                compNode = new FeatureNode(context, FeatureNode.NODE_TYPE_COMPOSITION);
                                //startNode.add(compNode);
                                treeTableModel.insertNodeInto(compNode, startNode, startNode.getChildCount());
                            }
                            //compNode.add(endNode);
                            treeTableModel.removeNodeFromParent(endNode);
                            treeTableModel.insertNodeInto(endNode, compNode, compNode.getChildCount());
                        } else if (relationName.equals(FeatureRelation.ATTRIBUTE)) {
                            FeatureNode compNode = startNode.getCharacterizationNode();
                            if (compNode == null) {
                                compNode = new FeatureNode(context, FeatureNode.NODE_TYPE_CHARACTERIZATION);
                                //startNode.add(compNode);
                                treeTableModel.insertNodeInto(compNode, startNode, startNode.getChildCount());
                            }
                            //compNode.add(endNode);
                            treeTableModel.removeNodeFromParent(endNode);
                            treeTableModel.insertNodeInto(endNode, compNode, compNode.getChildCount());
                        }
                    }
                } else if (propertyName.equals(FeatureModelProperties.RELATION_REMOVED)) {
                    //--���ɾ���˾�����ϵ����endNode��Ϊroot, ���endNode�ĸ��ڵ�(��ϵ�ڵ㣩û�������ӽڵ��ˣ���ɾ��endNode�ĸ��ڵ�
                    FeatureRelation fr = (FeatureRelation) evt.getOldValue();
                    String relationName = fr.getName();

                    if (refineRelation.containsKey(relationName)) {
                        Feature start = fr.getStartFeature();
                        Feature end = fr.getEndFeature();
                        FeatureNode startNode = getTreeNode(root, start);
                        FeatureNode endNode = getTreeNode(root, end);
                        FeatureNode relationNode = (FeatureNode) endNode.getParent();

                        //root.add(endNode);
View Full Code Here

                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();
                            //root.add(sinkNode);
                            treeTableModel.insertNodeInto(sinkNode, root, root.getChildCount());
                        }
View Full Code Here

    }
  }
 
  public static void fillPredicate(Collection<Feature> features , Constraint cons , ConstraintModel cm , CustomizationVersion cv , Predicate pDest) {
    for (Iterator<Feature> itFeature = features.iterator() ; itFeature.hasNext() ; ) {
      Feature f = itFeature.next();
      Customization cus = getCFCustomization(f , cv.getFinalCustomizationById(f.getID()) , cons , cm);
      pDest.addValue(cus);
    }
  }
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.