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

fitlibraryGeneric.specify.collections.GenericMaps Maven / Gradle / Ivy

Go to download

FitLibrary provides general-purpose fixtures (and runners) for storytests with Fit and FitNesse.

The newest version!
/*
 * Copyright (c) 2006 Rick Mugridge, www.RimuResearch.com
 * Released under the terms of the GNU General Public License version 2 or later.
 * Written: 23/09/2006
*/

package fitlibraryGeneric.specify.collections;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import fitlibrary.collection.map.ListOfMapsTraverse;
import fitlibrary.collection.map.SubsetMapTraverse;
import fitlibrary.specify.eg.Colour;

public class GenericMaps {
	private Map aMap = new HashMap();
	private Map> aMapOfMaps  = new HashMap>();

	public GenericMaps() {
		aMap.put(Colour.GREEN, Colour.BLUE);
		aMap.put(Colour.BLACK, Colour.YELLOW);		
		
		cyclicMaps(Colour.RED, Colour.GREEN);
		cyclicMaps(Colour.WHITE,Colour.BLACK);
		cyclicMaps(Colour.BLUE, Colour.YELLOW);
	}
	private void cyclicMaps(Colour colour1, Colour colour2) {
		Map map1 = new HashMap();
		map1.put(colour2,colour1);
		aMapOfMaps.put(colour1,map1);
	}
	public Map> getAMapOfMaps() {
		return aMapOfMaps;
	}
	public void setAMapOfMaps(Map> mapOfMaps) {
		aMapOfMaps = mapOfMaps;
	}
	public Map getAMap() {
		return aMap;
	}
	public void setAMap(Map map) {
		aMap = map;
	}
	@SuppressWarnings("unchecked")
	public SubsetMapTraverse aSubsetMap() {
		return new SubsetMapTraverse(new HashMap(aMap));
	}
	 public ListOfMapsTraverse aListOfMaps() {
		 List> maps = new ArrayList>();
		 HashMap map = new HashMap();
		 map.put("color", Colour.RED);
		 map.put("count", 1);
		 maps.add(map);
		 map = new HashMap();
		 map.put("color", Colour.GREEN);
		 map.put("count", 2);
		 maps.add(map);
		 map = new HashMap();
		 map.put("color", Colour.YELLOW);
		 map.put("count", "three");
		 maps.add(map);
		 return new ListOfMapsTraverse(maps);
	 }
	 public ListOfMapsTraverse aListOfMapsWithEmpty() {
		 List> maps = new ArrayList>();
		 HashMap map = new HashMap();
		 map.put("color", Colour.RED);
		 map.put("count", 1);
		 maps.add(map);
		 map = new HashMap();
		 map.put("count", 2);
		 maps.add(map);
		 return new ListOfMapsTraverse(maps);
	 }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy