Examples of BenchmarkGoalImpl


Examples of eu.planets_project.tb.impl.model.benchmark.BenchmarkGoalImpl

  /* (non-Javadoc)
   * @see eu.planets_project.tb.api.model.benchmark.BenchmarkGoalsHandler#getBenchmarkGoal(java.lang.String)
   */
  public BenchmarkGoal getBenchmarkGoal(String sID){
    //returns a new BenchmarkGoal instance from a template
    BenchmarkGoalImpl ret = new BenchmarkGoalImpl();
    BenchmarkGoal template = this.hmBmGoals.get(sID);
    if(template !=null){
      ret = ((BenchmarkGoalImpl)this.hmBmGoals.get(sID)).clone();
      /*ret.setCategory(template.getCategory());
      ret.setDefinition(template.getDefinition());
 
View Full Code Here

Examples of eu.planets_project.tb.impl.model.benchmark.BenchmarkGoalImpl

       NamedNodeMap catattributes = category.getAttributes();
       String sCategory = catattributes.getNamedItem("name").getNodeValue();
       if(sCategory.equals(sCategoryName)){  
         //now parse items
         for(int i=0;i<items.getLength();i++){
           BenchmarkGoalImpl bmGoal = new BenchmarkGoalImpl();
           Node item = items.item(i);

           if(item.getNodeName().equals("item") && item.getNodeType() == Node.ELEMENT_NODE){
             //Now within an item (=benchmarkGoal)
             NamedNodeMap attributes = item.getAttributes();
             bmGoal.setCategory(sCategoryName);
             bmGoal.setID(attributes.getNamedItem("id").getNodeValue());
             bmGoal.setType(attributes.getNamedItem("type").getNodeValue());
             bmGoal.setScale(attributes.getNamedItem("scale").getNodeValue());
             bmGoal.setVersion(attributes.getNamedItem("version").getNodeValue());
             //now get childNodesw: definition and description
             NodeList itemchilds =  item.getChildNodes();
             for(int j=0;j<itemchilds.getLength();j++){
               if(itemchilds.item(j).getNodeType() == Node.ELEMENT_NODE){
                 if(itemchilds.item(j).getNodeName().equals("definition")){
                   bmGoal.setDefinition(itemchilds.item(j).getTextContent());
                 }
                 if(itemchilds.item(j).getNodeName().equals("description")){
                   bmGoal.setDescription(itemchilds.item(j).getTextContent());
                 }
                 if(itemchilds.item(j).getNodeName().equals("name")){
                   bmGoal.setName(itemchilds.item(j).getTextContent());
                 }
               }
             }
          
             if(this.hmBmGoals.containsKey(bmGoal.getID()))
               this.hmBmGoals.remove(bmGoal.getID());
             this.hmBmGoals.put(bmGoal.getID(), bmGoal);
           }
         }
       }
       //End Check if correct category name
     }
View Full Code Here

Examples of eu.planets_project.tb.impl.model.benchmark.BenchmarkGoalImpl

  public void evaluateExperimentBenchmarkGoal(String addedBenchmarkGoalID,
      String sSourceValue, String sTargetValue, String sEvaluationValue) throws InvalidInputException{
   
    if(this.getInputBenchmarkGoals().keySet().contains(addedBenchmarkGoalID)){
      //get the input BenchmarkGoal
      BenchmarkGoalImpl goal = ((BenchmarkGoalImpl)this.getInputBenchmarkGoals().get(addedBenchmarkGoalID)).clone();
     
      String oldSourceValue="";
      String oldTargetValue="";
      String oldEvaluationValue="";
      if(this.experimentBenchmarkGoals.keySet().contains(addedBenchmarkGoalID)){
        BenchmarkGoal bmTemp = experimentBenchmarkGoals.get(addedBenchmarkGoalID);
        oldSourceValue = bmTemp.getSourceValue();
        oldTargetValue = bmTemp.getTargetValue();
        oldEvaluationValue = bmTemp.getEvaluationValue();
       
        //now remove the old goal - it's being replaced
        this.experimentBenchmarkGoals.remove(addedBenchmarkGoalID);
      }
     
      if((sSourceValue!=null)&&(!sSourceValue.equals(""))){
        goal.setSourceValue(sSourceValue);
      }
      else{
        //check if we have some old values to set:
        if((sSourceValue==null)&&(oldSourceValue!=null)&&(!oldSourceValue.equals(""))){
          goal.setSourceValue(oldSourceValue);
        }
      }
      if((sTargetValue!=null)&&(!sTargetValue.equals(""))){
        goal.setTargetValue(sTargetValue);
      }
      else{
        //check if we have some old values to set:
        if((sTargetValue==null)&&(oldTargetValue!=null)&&(!oldTargetValue.equals(""))){
          goal.setTargetValue(oldTargetValue);
        }
      }
      if((sEvaluationValue!=null)&&(!sEvaluationValue.equals(""))){
        goal.setEvaluationValue(sEvaluationValue);
      }
      else{
        //check if we have some old values to set:
        if((sEvaluationValue==null)&&(oldEvaluationValue!=null)&&(!oldEvaluationValue.equals(""))){
          goal.setEvaluationValue(oldEvaluationValue);
        }
      }
     
      this.experimentBenchmarkGoals.put(goal.getID(), goal);
    }
    else{
      throw new InvalidInputException("evaluateExperimentBenchmarkGoal failed: InputBenchmarkGoalID "+addedBenchmarkGoalID+" not contained.");
    }
   
View Full Code Here

Examples of eu.planets_project.tb.impl.model.benchmark.BenchmarkGoalImpl

  public void evaluateFileBenchmarkGoal(Entry<URI, URI> ioFile,
      String addedBenchmarkGoalID, String sSourceValue, String sTargetValue, String sEvaluationValue) throws InvalidInputException{
   
    if((this.getInputBenchmarkGoals().keySet().contains(addedBenchmarkGoalID))&&(this.fileBenchmarkGoals.containsKey(ioFile.getKey()))){
      //get the input BenchmarkGoal
      BenchmarkGoalImpl goal = ((BenchmarkGoalImpl)this.getInputBenchmarkGoals().get(addedBenchmarkGoalID)).clone();
     
      //get file's BenchmarkGoalSet
      HashMap<String,BenchmarkGoalImpl> hmFileGoals = this.fileBenchmarkGoals.get(ioFile.getKey());
     
      String oldSourceValue="";
      String oldTargetValue="";
      String oldEvaluationValue="";
      if(hmFileGoals.keySet().contains(addedBenchmarkGoalID)){
        BenchmarkGoal bmTemp = hmFileGoals.get(addedBenchmarkGoalID);
        oldSourceValue = bmTemp.getSourceValue();
        oldTargetValue = bmTemp.getTargetValue();
        oldEvaluationValue = bmTemp.getEvaluationValue();
        //now remove the old goal - it's being replaced
        hmFileGoals.remove(addedBenchmarkGoalID);
      }
     
      //set value:
      if((sSourceValue!=null)&&(!sSourceValue.equals(""))){
        goal.setSourceValue(sSourceValue);
      }
      else{
        //check if we have some old values to set:
        if((sSourceValue==null)&&(oldSourceValue!=null)&&(!oldSourceValue.equals(""))){
          goal.setSourceValue(oldSourceValue);
        }
      }
      if((sTargetValue!=null)&&(!sTargetValue.equals(""))){
        goal.setTargetValue(sTargetValue);
      }
      else{
        //check if we have some old values to set:
        if((sTargetValue==null)&&(oldTargetValue!=null)&&(!oldTargetValue.equals(""))){
          goal.setTargetValue(oldTargetValue);
        }
      }
      if((sEvaluationValue!=null)&&(!sEvaluationValue.equals(""))){
        goal.setEvaluationValue(sEvaluationValue);
      }
      else{
        //check if we have some old values to set:
        if((sEvaluationValue==null)&&(oldEvaluationValue!=null)&&(!oldEvaluationValue.equals(""))){
          goal.setEvaluationValue(oldEvaluationValue);
        }
      }
     
      //now put back the goal
      hmFileGoals.put(goal.getID(), goal);
    }
    else{
      throw new InvalidInputException("evaluateFileBenchmarkGoal failed. Unsupported BenchmarkGoal or InvalidInput File");
    }
  }
View Full Code Here

Examples of eu.planets_project.tb.impl.model.benchmark.BenchmarkGoalImpl

  public void evaluateFileBenchmarkGoal(URI inputFile, String addedBenchmarkGoalID,
      String sSourceValue, String sTargetValue, String sEvaluationValue) throws InvalidInputException{
   
    if((this.getInputBenchmarkGoals().keySet().contains(addedBenchmarkGoalID))&&(this.getInputFileURIs().contains(inputFile))){
      //get the input BenchmarkGoal
      BenchmarkGoalImpl goal = ((BenchmarkGoalImpl)this.getInputBenchmarkGoals().get(addedBenchmarkGoalID)).clone();
      //get file's BenchmarkGoalSet
      HashMap<String,BenchmarkGoalImpl> hmFileGoals = this.fileBenchmarkGoals.get(inputFile);
     
      //checks if for this inputfile a HashMap has already been created or if it's the first time
      boolean bMarker = false;
      if(hmFileGoals == null){
        hmFileGoals = new HashMap<String, BenchmarkGoalImpl>();
        bMarker = true;
      }
     
      String oldSourceValue="";
      String oldTargetValue="";
      String oldEvaluationValue="";
      if(hmFileGoals.keySet().size()>0){
        if(hmFileGoals.keySet().contains(addedBenchmarkGoalID)){
          BenchmarkGoal bmTemp = hmFileGoals.get(addedBenchmarkGoalID);
          oldSourceValue = bmTemp.getSourceValue();
          oldTargetValue = bmTemp.getTargetValue();
          oldEvaluationValue = bmTemp.getEvaluationValue();
          hmFileGoals.remove(addedBenchmarkGoalID);
        }
      }

      //set value:
      if((sSourceValue!=null)&&(!sSourceValue.equals(""))){
        goal.setSourceValue(sSourceValue);
      }
      else{
        //check if we have some old values to set:
        if((sSourceValue==null)&&(oldSourceValue!=null)&&(!oldSourceValue.equals(""))){
          goal.setSourceValue(oldSourceValue);
        }
      }
      if((sTargetValue!=null)&&(!sTargetValue.equals(""))){
        goal.setTargetValue(sTargetValue);
      }
      else{
        //check if we have some old values to set:
        if((sTargetValue==null)&&(oldTargetValue!=null)&&(!oldTargetValue.equals(""))){
          goal.setTargetValue(oldTargetValue);
        }
      }
      if((sEvaluationValue!=null)&&(!sEvaluationValue.equals(""))){
        goal.setEvaluationValue(sEvaluationValue);
      }
      else{
        //check if we have some old values to set:
        if((sEvaluationValue==null)&&(oldEvaluationValue!=null)&&(!oldEvaluationValue.equals(""))){
          goal.setEvaluationValue(oldEvaluationValue);
        }
      }
     
      hmFileGoals.put(goal.getID(), goal);
      if(bMarker){
        this.fileBenchmarkGoals.put(inputFile, hmFileGoals);
      }
    }
    else{
View Full Code Here

Examples of eu.planets_project.tb.impl.model.benchmark.BenchmarkGoalImpl

   
      List<BenchmarkGoal> inputBMGoals = thisExperiment.getExperimentSetup().getAllAddedBenchmarkGoals();
      if((inputBMGoals!=null)&&(inputBMGoals.size()>0)){
        Iterator<BenchmarkGoal> itBMGoals = inputBMGoals.iterator();
        while(itBMGoals.hasNext()){
          BenchmarkGoalImpl bmGoal = ((BenchmarkGoalImpl)itBMGoals.next()).clone();
          hmRet.put(bmGoal.getID(), bmGoal);
        }
      }
      return hmRet;
    }
    else{
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.