// $Header$
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

package org.apache.jmeter.samplers;

import java.util.HashMap;
// import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
// import java.util.Set;

import org.apache.jmeter.assertions.Assertion;
import org.apache.jmeter.config.ConfigElement;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

/**
 * @author Michael Stover
 * @version $Revision$
 */
public class Entry {
	transient private static Logger log = LoggingManager.getLoggerForClass();

	Map configSet;

	// Set clonedSet;
	Class sampler;

	List assertions;

	public Entry() {
		configSet = new HashMap();
		// clonedSet = new HashSet();
		assertions = new LinkedList();
	}

	public void addAssertion(Assertion assertion) {
		assertions.add(assertion);
	}

	public List getAssertions() {
		return assertions;
	}

	public void setSamplerClass(Class samplerClass) {
		this.sampler = samplerClass;
	}

	public Class getSamplerClass() {
		return this.sampler;
	}

	public ConfigElement getConfigElement(Class configClass) {
		return (ConfigElement) configSet.get(configClass);
	}

	public void addConfigElement(ConfigElement config) {
		addConfigElement(config, config.getClass());
	}

	/**
	 * Add a config element as a specific class. Usually this is done to add a
	 * subclass as one of it's parent classes.
	 */
	public void addConfigElement(ConfigElement config, Class asClass) {
		if (config != null) {
			ConfigElement current = (ConfigElement) configSet.get(asClass);
			if (current == null) {
				configSet.put(asClass, cloneIfNecessary(config));
			} else {
				current.addConfigElement(config);
			}
		}
	}

	private ConfigElement cloneIfNecessary(ConfigElement config) {
		if (config.expectsModification()) {
			return config;
		} else {
			return (ConfigElement) config.clone();
		}
	}

	public Object clone() {
		try {
			return super.clone();
		} catch (Exception ex) {
			log.error("", ex);
		}
		return null;
	}
}

@@ -1,16 +1,4 @@
-// $Header$%0A
 /*%0A 
@@ -1066,18 +1066,8 @@
  %7B%0A%09
-transient 
 priv
@@ -1077,16 +1077,22 @@
  static 
+final 
 Logger l
@@ -1134,16 +1134,24 @@
 ss();%0A%0A%09
+private 
 Map conf
@@ -1178,16 +1178,24 @@
 edSet;%0A%09
+private 
 Class sa
@@ -1203,16 +1203,24 @@
 pler;%0A%0A%09
+private 
 List ass
@@ -2408,25 +2408,17 @@
 fig;%0A%09%09%7D
- else %7B%0A%09
+%0A
 %09%09return
@@ -2450,20 +2450,16 @@
 lone();%0A
-%09%09%7D%0A
 %09%7D%0A%0A%09pub
@@ -2560,16 +2560,31 @@
 %22%22, ex);
+ // $NON-NLS-1$
 %0A%09%09%7D%0A%09%09r

Tidy up; add NLS markers