Package de.FeatureModellingTool.FeatureModel

Examples of de.FeatureModellingTool.FeatureModel.Feature


 
  protected void buildGraph() {
    HashMap<Feature,NNode> builtFeatures = new HashMap<Feature,NNode>();
    for (Iterator<Feature> itFeature=this.featureModel.getAllFeature().values().iterator()
        ; itFeature.hasNext() ; ) {
      Feature feature = itFeature.next();
      if (!builtFeatures.containsKey(atomMap.get(feature))) {
        NNode node = new NNode(atomMap.get(feature));
        this.graph.nodes.put(node.feature , node);
        builtFeatures.put(atomMap.get(feature) , node);
      }
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);
View Full Code Here

        genDependentSet();
        printDependentSet();
      boolean hasConflict = false;
      Iterator iter = fchkInfoModel.getSeedFeatures().iterator();
      while(iter.hasNext()) {
        Feature f = (Feature)iter.next();
        FeatureCheckInfo fchkInfo = fchkInfoModel.getFeatureCheckInfo(f);
        if(isConflictInDependentSet(fchkInfo.getDependentSet()))
          hasConflict = true
     
      if(hasConflict) {
View Full Code Here

    }

  protected void getSeedFeatures() throws ModelInvalidateException {
    Iterator iter = featureModel.getAllFeature().values().iterator();
    while(iter.hasNext()) {
      Feature f = (Feature)iter.next();
     
      if(f.getVariability()==Variability.Null) {
        throw new ModelInvalidateException(ModelInvalidateException.FeatureInfoNotEnough);  
      }
     
      if(f.getVariability()==Variability.Optional
        || f.getVariability()==Variability.Alternative) {
        fchkInfoModel.addSeedFeature(f);
      }
     
      Feature rf = fchkInfoModel.getRootOfFeature(f);
      fchkInfoModel.addSeedFeature(rf)
    }   
  }
View Full Code Here

    //find out all seed features
    getSeedFeatures();
    //calculate their atomic set
    Iterator iter = fchkInfoModel.getSeedFeatures().iterator();
    while(iter.hasNext()) {
      Feature f = (Feature)iter.next();
      if(fchkInfoModel.isFeatureNotInAnyAtmoicSet(f)) {
        //create a atmoic set that contains "f"
        AtomicFeatureSet as = new AtomicFeatureSet();
        as.setSeed(f);
        fchkInfoModel.addFeatureToAtomicSet(f, as);
View Full Code Here

 
  protected void printAtomicSet() {
    //System.out.println("Begin print Atomic Set: ");
    Iterator iter = fchkInfoModel.getSeedFeatures().iterator();
    while(iter.hasNext()) {
      Feature f = (Feature)iter.next();
      //System.out.println("Seed Feature: " + f.getName() + ", its Atomic Set contains:");
      FeatureCheckInfo fchkInfo = fchkInfoModel.getFeatureCheckInfo(f);
      HashSet fs = fchkInfo.getAtomicSet().getFeatures();
      Iterator iter2 = fs.iterator();
      while(iter2.hasNext()) {
        Feature af = (Feature)iter2.next();
        //System.out.print(af.getName() + "/");
      }
      //System.out.println(";");
    }
  }
View Full Code Here

        }
      } while(!stop);
      //generate dependent set
      Iterator seedIter = fchkInfoModel.getSeedFeatures().iterator();
      while(seedIter.hasNext()) {
        Feature sf = (Feature)seedIter.next();
        fchkInfoModel.genDependentSetOfFeature(sf);
      }
    } else {
      Iterator seedIter = fchkInfoModel.getSeedFeatures().iterator();
      while(seedIter.hasNext()) {
        Feature sf = (Feature)seedIter.next();
        FeatureCheckInfo fchkInfo = fchkInfoModel.getFeatureCheckInfo(sf);
        DependentFeatureSet ds = new DependentFeatureSet();
        ds.setSource(sf);
        ds.setFeatures(fchkInfo.getAtomicSet().getFeatures());
        fchkInfo.setDependentSet(ds);
View Full Code Here

 
  protected void printDependentSet() {
    //System.out.println("Begin print Dependent Set: ");
    Iterator iter = fchkInfoModel.getSeedFeatures().iterator();
    while(iter.hasNext()) {
      Feature f = (Feature)iter.next();
      //System.out.println("Seed Feature: " + f.getName() + ", its Dependent Set contains:");
      FeatureCheckInfo fchkInfo = fchkInfoModel.getFeatureCheckInfo(f);
      HashSet fs = fchkInfo.getDependentSet().getFeatures();
      Iterator iter2 = fs.iterator();
      while(iter2.hasNext()) {
        Feature af = (Feature)iter2.next();
        //System.out.print(af.getName() + "/");
      }
      //System.out.println(";");
    }   
  }
View Full Code Here

    Map relations = featureModel.getAllFeatureRelation(FeatureRelation.EXCLUDE);
    if(relations!=null && relations.size()>0) {
      Iterator iter = relations.values().iterator();
      while(iter.hasNext()) {
        FeatureRelation relation = (FeatureRelation)iter.next();
        Feature start = relation.getStartFeature();
        Feature end = relation.getEndFeature();
        if(features.contains(start) && features.contains(end)) {
          conflictRelations.add(relation);
          hasConflict = true;
       
      }
View Full Code Here

     
      addChild(null , Integer.toString(i) , treeWidth , treeHeight , features);
    }
  }
  private void addChild(Feature root , String featureName , int treeWidth , int treeHeight , List<Feature> features) {
    Feature feature = this.featureModelEditor.addFeature(featureName);
    this.featureEditor.setVariability(feature , Variability.Optional);
    if (root!=null) {
      featureModelEditor.addRelation(FeatureRelation.DECOMPOSE , root, feature);
    }
    features.add(feature);
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.