/** * 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(); } } }
/** * 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; }
/** * 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; }
/** * 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(); }
/** * 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); }
/** * 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(); } } }