Package de.FeatureModellingTool.FeatureModel

Examples of de.FeatureModellingTool.FeatureModel.CompositeConstraint


      }
    }
    if (this.constraintModel.getAllCompositeConstraint()!=null) {
      for (Iterator<CompositeConstraint> itCC=this.constraintModel.getAllCompositeConstraint().values().iterator()
          ; itCC.hasNext() ; ) {
        CompositeConstraint cc = itCC.next();
        List<Feature> featureList = new ArrayList<Feature>(cc.getSourceFeatureSet());
        featureList.addAll(cc.getSinkFeatureSet());
        for (int i=0 ; i<featureList.size() ; i++) {
          for (int j=i+1 ; j<featureList.size() ; j++) {
            NNode startNode = builtFeatures.get(featureList.get(i));
            NNode endNode = builtFeatures.get(featureList.get(j));
            startNode.addEdge(endNode);
View Full Code Here


      }
    }
  }
  protected void addCompositeConstraint(int compositeCount , int featurePerPredict , CompositeConstraintType cct) {
    for (int i=0 ; i<compositeCount ; i++) {
      CompositeConstraint cc = this.constraintModelEditor.addCompositeConstraint();
      this.compositeConstraintEditor.setPLType(cc , cct);
      this.compositeConstraintEditor.setSourceType(cc , CompositeConstraintPortType.Multi);
      this.compositeConstraintEditor.setSinkType(cc , CompositeConstraintPortType.Multi);

      List<Feature> features = this.getRandomFeatures(featurePerPredict*2);
 
View Full Code Here

        return false;
      }
      if (!(constraint instanceof CompositeConstraint)) {
        return false;
      }
      CompositeConstraint cc = (CompositeConstraint)constraint;
      if (cc.getSourceFeatureSet().contains(node.getFeature())) {
        label.setIcon(getNodeIcon(node));
        render.setHorizontalAlignment(SwingConstants.LEFT);
        return true;
      }
      if (cc.getSinkFeatureSet().contains(node.getFeature())) {
        label.setIcon(getNodeIcon(node));
        render.setHorizontalAlignment(SwingConstants.RIGHT);
        return true;
      }
      return false;
View Full Code Here

    public String getConstraintName(Object cons) {
      if (!(cons instanceof FeatureRelation)) {
        return "";
      }
      CompositeConstraint cc = (CompositeConstraint)cons;
     
      return "Composite";
    }
View Full Code Here

   
    public ImageIcon getConstraintIcon(Object cons , ConstraintModel constraintModel , CustomizationVersion cv) {
      if (!(cons instanceof CompositeConstraint)) {
        return null;
      }
      CompositeConstraint cc = (CompositeConstraint)cons;
      if (cv!=null) {
        List<Customization> sCustomization = new ArrayList<Customization>();
        for (Iterator<Feature> itFeature=cc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature feature = itFeature.next();
          CFRelation cf = constraintModel.getCFRelation(feature , cc , true);
          if (cf==null) {
              cf = constraintModel.getCFRelation(feature , cc , false);
          }
          sCustomization.add(super.convertCustomization(cv.getFinalCustomizationById(feature.getID()) , cf));
        }
        Customization lValue = Customization.Undecided;
        if (cc.getSourceType().getName().equals(CompositeConstraintPortType.Single.getName())) {
          if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
            lValue = Customization.Undecided;
          } else if (super.getCustomizationCount(sCustomization , Customization.Selected)==1) {
            lValue = Customization.Selected;
          } else {
            lValue = Customization.Unselected;
          }
        } else if (cc.getSourceType().getName().equals(CompositeConstraintPortType.All.getName())) {
          if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
            lValue = Customization.Undecided;
          } else if (super.getCustomizationCount(sCustomization , Customization.Unselected)==0) {
            lValue = Customization.Selected;
          } else {
            lValue = Customization.Unselected;
          }
        } else /*if (gc.getType().getName().equals(GroupConstraintType.SingleGroup))*/ {
          if (super.getCustomizationCount(sCustomization , Customization.Selected)>0) {
            lValue = Customization.Selected;
          } else if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
            lValue = Customization.Undecided;
          } else {
            lValue = Customization.Unselected;
          }
        }
       
        sCustomization = new ArrayList<Customization>();
        for (Iterator<Feature> itFeature=cc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature feature = itFeature.next();
          CFRelation cf = constraintModel.getCFRelation(feature , cc , true);
          if (cf==null) {
              cf = constraintModel.getCFRelation(feature , cc , false);
          }
          sCustomization.add(super.convertCustomization(cv.getFinalCustomizationById(feature.getID()) , cf));
        }
        Customization rValue = Customization.Undecided;
        if (cc.getSinkType().getName().equals(CompositeConstraintPortType.Single.getName())) {
          if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
            rValue = Customization.Undecided;
          } else if (super.getCustomizationCount(sCustomization , Customization.Selected)==1) {
            rValue = Customization.Selected;
          } else {
            rValue = Customization.Unselected;
          }
        } else if (cc.getSinkType().getName().equals(CompositeConstraintPortType.All.getName())) {
          if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
            rValue = Customization.Undecided;
          } else if (super.getCustomizationCount(sCustomization , Customization.Unselected)==0) {
            rValue = Customization.Selected;
          } else {
            rValue = Customization.Unselected;
          }
        } else /*if (gc.getType().getName().equals(GroupConstraintType.SingleGroup))*/ {
          if (super.getCustomizationCount(sCustomization , Customization.Selected)>0) {
            rValue = Customization.Selected;
          } else if (super.getCustomizationCount(sCustomization , Customization.Undecided)>0) {
            rValue = Customization.Undecided;
          } else {
            rValue = Customization.Unselected;
          }
        }
       
        return ImageManager.getInstance().getCompositeConstraintHeader(cc.getSourceType() , cc.getSinkType() , cc.getPLType() , lValue , rValue , ImageManager.ConstraintStat.csNone);
      }
      else
      {
        return ImageManager.getInstance().getCompositeConstraintHeader(cc.getSourceType() , cc.getSinkType() , cc.getPLType() , null , null , ImageManager.ConstraintStat.csNone);
      }
    }
View Full Code Here

    public boolean isRelatedFeature(Object cons , Feature feature) {
      if (!(cons instanceof CompositeConstraint)) {
        return false;
      }
      CompositeConstraint cc = (CompositeConstraint)cons;
      return cc.getSourceFeatureSet().contains(feature) || cc.getSinkFeatureSet().contains(feature);
    }
View Full Code Here

   
    public Set<Feature> getRelatedFeatures(Object cons) {
      if (!(cons instanceof CompositeConstraint)) {
        return null;
      }
      CompositeConstraint cc = (CompositeConstraint)cons;
      Set<Feature> result = new HashSet<Feature>();
      result.addAll(cc.getSourceFeatureSet());
      result.addAll(cc.getSinkFeatureSet());
      return result;
    }
View Full Code Here

//    Map<Feature,  AtomedFeature>  allAtomedFeature  =  atomSet.getAllAtomedFeatures();
    Map  compositeConstraint  =  constraintModel.getAllCompositeConstraint();
    Iterator  e  =  compositeConstraint.keySet().iterator();
    while(e.hasNext()){
    //  System.out.println("*************Building_CompositeConstraint");
      CompositeConstraint  c  =  (CompositeConstraint)compositeConstraint.get(e.next());
      Set  sourceFeature  =  c.getSourceFeatureSet();
      Set  sinkFeature    =  c.getSinkFeatureSet();
      if(sourceFeature.isEmpty()  ||  sinkFeature.isEmpty())
        continue;
     
      CompositeConstraintType  type  =  c.getPLType();
      int  tempBddi  =  -1,
        tempBddj  =  -1;
     
//      ����source��BDD     
      if      (c.getSourceType()  ==  CompositeConstraintPortType.All){
        tempBddi  =  1;
        Iterator  i  =  sourceFeature.iterator();
        while(i.hasNext()){
          AtomedFeature  x  =  allAtomedFeatures.get((Feature)i.next());
          if (constraintModel.getCFRelation(x.feature, c, true).getModifier().equals(CFRModifier.Affirmation))
            tempBddi  =  bdd.andTo(tempBddi, x.BddVar);
          else
            tempBddi  =  bdd.andTo(tempBddi, bdd.not(x.BddVar));
        }
      }
      else  if  (c.getSourceType()  ==  CompositeConstraintPortType.Multi){
      /*  if(type  ==  CompositeConstraintType.Mutex)
          tempBddi  =  0;
        else
          tempBddi  =  1;*/
        tempBddi  =  0;
        Iterator  i  =  sourceFeature.iterator();
        while(i.hasNext()){
          AtomedFeature  x  =  allAtomedFeatures.get((Feature)i.next());
          if (constraintModel.getCFRelation(x.feature, c, true).getModifier().equals(CFRModifier.Affirmation))
            tempBddi  =  bdd.orTo(tempBddi, x.BddVar);
          else
            tempBddi  =  bdd.orTo(tempBddi, bdd.not(x.BddVar));
        }
      }
      else  if  (c.getSourceType()  ==  CompositeConstraintPortType.Single){
        Iterator  i  =  sourceFeature.iterator();
        tempBddi  =  0;
        while(i.hasNext()){
          AtomedFeature  x  =  allAtomedFeatures.get((Feature)i.next());
          int  temp;
          if (constraintModel.getCFRelation(x.feature, c, true).getModifier().equals(CFRModifier.Affirmation))
            temp =  x.BddVar;
          else
            temp = bdd.not(x.BddVar);
          Iterator  j  =  sourceFeature.iterator();
          while(j.hasNext()){
            AtomedFeature  y  =  allAtomedFeatures.get((Feature)j.next());
            if(x  ==  ycontinue;
            if (constraintModel.getCFRelation(y.feature, c, true).getModifier().equals(CFRModifier.Affirmation))
              temp  =  bdd.andTo(temp, bdd.not(y.BddVar));
            else
              temp  =  bdd.andTo(temp, y.BddVar);
             
          }         
          tempBddi  =  bdd.orTo(tempBddi,  temp);
        }
      }//end if
     
//      ����sink��BDD
      if      (c.getSinkType()  ==  CompositeConstraintPortType.All){
        tempBddj  =  1;
        Iterator  i  =  sinkFeature.iterator();
        while(i.hasNext()){
          AtomedFeature  x  =  allAtomedFeatures.get((Feature)i.next());
          if (constraintModel.getCFRelation(x.feature, c, false).getModifier().equals(CFRModifier.Affirmation))
            tempBddj  =  bdd.andTo(tempBddj, x.BddVar);
          else
            tempBddj  =  bdd.andTo(tempBddj, bdd.not(x.BddVar));
        }
      }
      else  if  (c.getSinkType()  ==  CompositeConstraintPortType.Multi){
      /*  if(type  ==  CompositeConstraintType.Mutex)
          tempBddj  =  0;
        else
          tempBddj  =  1;*/
        tempBddj  =  0;
        Iterator  i  =  sinkFeature.iterator();
        while(i.hasNext()){
          AtomedFeature  x  =  allAtomedFeatures.get((Feature)i.next());
          if (constraintModel.getCFRelation(x.feature, c, false).getModifier().equals(CFRModifier.Affirmation))
            tempBddj  =  bdd.orTo(tempBddj, x.BddVar);
          else
            tempBddj  =  bdd.orTo(tempBddj, bdd.not(x.BddVar));
        }
      }
      else  if  (c.getSinkType()  ==  CompositeConstraintPortType.Single){
        Iterator  i  =  sinkFeature.iterator();
        tempBddj  =  0;
        while(i.hasNext()){
          AtomedFeature  x  =  allAtomedFeatures.get((Feature)i.next());
          int  temp;
View Full Code Here

    }
   
    constraints.clear();
    constraints.addAll(constraintModel.getAllCompositeConstraint().values());
    for (Iterator<CompositeConstraint> itConstraint = constraints.iterator() ; itConstraint.hasNext() ; ) {
      CompositeConstraint gc = itConstraint.next();
     
      boolean newFeature = false;
      boolean allNewFeature = true;
      for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
        Feature constraintFeature = itFeature.next();
        if (htNameMap.containsKey(constraintFeature.getID())) {
          newFeature = true;
        } else {
          allNewFeature = false;
        }
      }
      for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
        Feature constraintFeature = itFeature.next();
        if (htNameMap.containsKey(constraintFeature.getID())) {
          newFeature = true;
        } else {
          allNewFeature = false;
        }
      }

      if (newFeature) {
        CompositeConstraint newConstraint = null;
        if (allNewFeature) {
          newConstraint = constraintModelEditor.addCompositeConstraint();
          compositeConstraintEditor.setPLType(newConstraint , gc.getPLType());
          compositeConstraintEditor.setSinkType(newConstraint , gc.getSinkType());
          compositeConstraintEditor.setSourceType(newConstraint , gc.getSourceType());
          htNameMap.put(gc.getID() , newConstraint.getID());
        } else {
          newConstraint = gc;
        }
       
        for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature constraintFeature = itFeature.next();
          if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
            constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
            compositeConstraintEditor.addSourceFeature(newConstraint , constraintFeature);
          }
        }
       
        for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature constraintFeature = itFeature.next();
          if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
            constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
            compositeConstraintEditor.addSinkFeature(newConstraint , constraintFeature);
          }
        }
      }
    }
   
    constraints.clear();
    constraints.addAll(constraintModel.getAllVPConstraint().values());
    for (Iterator<VPConstraint> itConstraint = constraints.iterator() ; itConstraint.hasNext() ; ) {
      VPConstraint gc = itConstraint.next();
     
      boolean newFeature = false;
      boolean allNewFeature = true;
      for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
        Feature constraintFeature = itFeature.next();
        if (htNameMap.containsKey(constraintFeature.getID())) {
          newFeature = true;
        } else {
          allNewFeature = false;
        }
      }
      for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
        Feature constraintFeature = itFeature.next();
        if (htNameMap.containsKey(constraintFeature.getID())) {
          newFeature = true;
        } else {
          allNewFeature = false;
        }
      }

      if (newFeature) {
        VPConstraint newConstraint = null;
        if (allNewFeature) {
          newConstraint = constraintModelEditor.addVPConstraint();
          vpConstraintEditor.setType(newConstraint , gc.getType());
          htNameMap.put(gc.getID() , newConstraint.getID());
        } else {
          newConstraint = gc;
        }
       
        for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature constraintFeature = itFeature.next();
          if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
            constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
            vpConstraintEditor.addSourceFeature(newConstraint , constraintFeature);
          }
        }
       
        for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator() ; itFeature.hasNext() ; ) {
          Feature constraintFeature = itFeature.next();
          if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
            constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
            vpConstraintEditor.addSinkFeature(newConstraint , constraintFeature);
          }
        }
      }
    }
   
    constraints.clear();
    constraints.addAll(constraintModel.getAllCFRelation().values());
    for (Iterator<CFRelation> itConstraint = constraints.iterator() ; itConstraint.hasNext() ; ) {
      CFRelation gc = itConstraint.next();

      boolean newFeature = false;
      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) {
        CFRelation newConstraint = constraintModelEditor.addCFRelation(cfFeature , cfConstraint , gc.isSource() , gc.getModifier());
        htNameMap.put(gc.getID() , newConstraint.getID());
      }
    }
  }
View Full Code Here

        }

        constraints.clear();
        constraints.addAll(constraintModel.getAllCompositeConstraint().values());
        for (Iterator<CompositeConstraint> itConstraint = constraints.iterator(); itConstraint.hasNext();) {
            CompositeConstraint gc = itConstraint.next();

            boolean newFeature = false;
            boolean allNewFeature = true;
            for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator(); itFeature.hasNext();) {
                Feature constraintFeature = itFeature.next();
                if (htNameMap.containsKey(constraintFeature.getID())) {
                    newFeature = true;
                } else {
                    allNewFeature = false;
                }
            }
            for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator(); itFeature.hasNext();) {
                Feature constraintFeature = itFeature.next();
                if (htNameMap.containsKey(constraintFeature.getID())) {
                    newFeature = true;
                } else {
                    allNewFeature = false;
                }
            }

            if (newFeature) {
                CompositeConstraint newConstraint = null;
                if (allNewFeature) {
                    newConstraint = constraintModelEditor.addCompositeConstraint();
                    compositeConstraintEditor.setPLType(newConstraint, gc.getPLType());
                    compositeConstraintEditor.setSinkType(newConstraint, gc.getSinkType());
                    compositeConstraintEditor.setSourceType(newConstraint, gc.getSourceType());
                    htNameMap.put(gc.getID(), newConstraint.getID());
                } else {
                    newConstraint = gc;
                }

                for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator(); itFeature.hasNext();) {
                    Feature constraintFeature = itFeature.next();
                    if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
                        constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
                        compositeConstraintEditor.addSourceFeature(newConstraint, constraintFeature);
                    }
                }

                for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator(); itFeature.hasNext();) {
                    Feature constraintFeature = itFeature.next();
                    if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
                        constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
                        compositeConstraintEditor.addSinkFeature(newConstraint, constraintFeature);
                    }
                }
            }
        }

        constraints.clear();
        constraints.addAll(constraintModel.getAllVPConstraint().values());
        for (Iterator<VPConstraint> itConstraint = constraints.iterator(); itConstraint.hasNext();) {
            VPConstraint gc = itConstraint.next();

            boolean newFeature = false;
            boolean allNewFeature = true;
            for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator(); itFeature.hasNext();) {
                Feature constraintFeature = itFeature.next();
                if (htNameMap.containsKey(constraintFeature.getID())) {
                    newFeature = true;
                } else {
                    allNewFeature = false;
                }
            }
            for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator(); itFeature.hasNext();) {
                Feature constraintFeature = itFeature.next();
                if (htNameMap.containsKey(constraintFeature.getID())) {
                    newFeature = true;
                } else {
                    allNewFeature = false;
                }
            }

            if (newFeature) {
                VPConstraint newConstraint = null;
                if (allNewFeature) {
                    newConstraint = constraintModelEditor.addVPConstraint();
                    vpConstraintEditor.setType(newConstraint, gc.getType());
                    htNameMap.put(gc.getID(), newConstraint.getID());
                } else {
                    newConstraint = gc;
                }

                for (Iterator<Feature> itFeature = gc.getSourceFeatureSet().iterator(); itFeature.hasNext();) {
                    Feature constraintFeature = itFeature.next();
                    if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
                        constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
                        vpConstraintEditor.addSourceFeature(newConstraint, constraintFeature);
                    }
                }

                for (Iterator<Feature> itFeature = gc.getSinkFeatureSet().iterator(); itFeature.hasNext();) {
                    Feature constraintFeature = itFeature.next();
                    if (allNewFeature || htNameMap.containsKey(constraintFeature.getID())) {
                        constraintFeature = featureModel.getFeature(htNameMap.get(constraintFeature.getID()));
                        vpConstraintEditor.addSinkFeature(newConstraint, constraintFeature);
                    }
                }
            }
        }

        constraints.clear();
        constraints.addAll(constraintModel.getAllCFRelation().values());
        for (Iterator<CFRelation> itConstraint = constraints.iterator(); itConstraint.hasNext();) {
            CFRelation gc = itConstraint.next();

            boolean newFeature = false;
            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) {
                CFRelation newConstraint = constraintModelEditor.addCFRelation(cfFeature, cfConstraint, gc.isSource(), gc.getModifier());
                htNameMap.put(gc.getID(), newConstraint.getID());
            }
        }
    }
View Full Code Here

TOP

Related Classes of de.FeatureModellingTool.FeatureModel.CompositeConstraint

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.