All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.testtoolinterfaces.testsuite.LooseTestInterfaceList Maven / Gradle / Ivy

/**
 * 
 */
package org.testtoolinterfaces.testsuite;

import java.util.Hashtable;
import java.util.Iterator;

/**
 * @author Arjan Kranenburg
 *
 * Uses the interfaceList to look for TestInterfaces.
 * Creates an UndefinedInterface if it does not exist.
 */
public class LooseTestInterfaceList implements TestInterfaceList
{
	TestInterfaceList myTestInterfaces = null;
	Hashtable myList;

	/**
	 * 
	 */
	public LooseTestInterfaceList()
	{
		myList = new Hashtable();
	}

	/**
	 * @param myTestInterfaces
	 */
	public LooseTestInterfaceList(TestInterfaceList aTestInterfaces)
	{
		myTestInterfaces = aTestInterfaces;
		myList = new Hashtable();
	}

	/* (non-Javadoc)
	 * @see org.testtoolinterfaces.testsuite.TestInterfaceList#getInterface(java.lang.String)
	 */
	public TestInterface getInterface(String anInterfaceName)
	{
		TestInterface testInterface = null;
		if ( myTestInterfaces != null )
		{
			testInterface = myTestInterfaces.getInterface(anInterfaceName);
		}
		
		if (testInterface == null)
		{
			testInterface = myList.get(anInterfaceName);
			if (testInterface == null)
			{
				testInterface = new UndefinedTestInterface( anInterfaceName );
				myList.put(anInterfaceName, testInterface);
			}
		}

		return testInterface;
	}

	public Iterator iterator()
	{
		// TODO not sure if this is sufficient. The local myList is not included
		return myTestInterfaces.iterator();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy