Ejemplo n.º 1
0
 /**
  * Remove the behavior entry with the specified name.
  *
  * @param behvName the name of the behavior to remove.
  */
 public void removeBehaviorMix(String behvName) {
   PropertyIterator iter = getBehaviorMix().iterator();
   while (iter.hasNext()) {
     BehaviorMixEntry behv = (BehaviorMixEntry) iter.next().getObjectValue();
     if (behv.getName().equals(behvName)) {
       iter.remove();
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * Returns the behavior mix as a Map.
  *
  * <p>Each behavior name is used as the entrie's key.
  *
  * @return the behavior mix map.
  */
 public Map<String, BehaviorMixEntry> getBehaviorMixAsMap() {
   PropertyIterator iter = getBehaviorMix().iterator();
   Map behaviorMixMap = new HashMap();
   while (iter.hasNext()) {
     BehaviorMixEntry behv = (BehaviorMixEntry) iter.next().getObjectValue();
     behaviorMixMap.put(behv.getName(), behv);
   }
   return behaviorMixMap;
 }
Ejemplo n.º 3
0
  /**
   * Initializes the behavior models (during test execution).
   *
   * <p>The behaior models are read from file. The map passed as parameter is used to map the state
   * names contained within the file to the ApplicationStates.
   *
   * @param stateNames2Ids map mapping all ApplicationState names to their ID.
   * @throws BehaviorException when an error during initialization occurs.
   */
  public synchronized void initialize(Map stateNames2Ids) throws BehaviorException {
    this.behaviorList.clear();
    int numBehaviors = this.getBehaviorCount();

    for (int i = 0; i < numBehaviors; i++) {
      BehaviorMixEntry behavior = (BehaviorMixEntry) this.getBehaviorEntry(i).clone();

      behavior.initializeModel(stateNames2Ids);
      this.behaviorList.add(behavior);
    }
    this.initialized = true;
  }
Ejemplo n.º 4
0
 /**
  * Create a string representation of the behavior mix.
  *
  * @return the string representation of the behavior mix.
  */
 @Override
 public String toString() {
   StringBuffer str = new StringBuffer();
   PropertyIterator iter = getBehaviorMix().iterator();
   while (iter.hasNext()) {
     BehaviorMixEntry behv = (BehaviorMixEntry) iter.next().getObjectValue();
     str.append(behv.getName() + behv.getRFreq() + behv.getFilename());
     if (iter.hasNext()) {
       str.append("&");
     }
   }
   return str.toString();
 }
Ejemplo n.º 5
0
 /**
  * Add a new behavior entry.
  *
  * @param behv the new behavior entry.
  */
 public void addBehaviorEntry(BehaviorMixEntry behv) {
   TestElementProperty newBehv = new TestElementProperty(behv.getName(), behv);
   if (isRunningVersion()) {
     this.setTemporary(newBehv);
   }
   getBehaviorMix().addItem(newBehv);
 }
Ejemplo n.º 6
0
 /**
  * Remove the specified behavior entry from the list.
  *
  * @param behv the entry to remove.
  */
 public void removeBehaviorMix(BehaviorMixEntry behv) {
   PropertyIterator iter = getBehaviorMix().iterator();
   while (iter.hasNext()) {
     BehaviorMixEntry item = (BehaviorMixEntry) iter.next().getObjectValue();
     if (behv.equals(item)) {
       iter.remove();
     }
   }
 }