use of java.util.LinkedHashMap in project SQLWindowing by hbutani.
the class WindowingTypeCheckProcFactory method genExprNode.
public static HashMap<Node, Object> genExprNode(ASTNode expr, TypeCheckCtx tcCtx) throws SemanticException {
// Create the walker, the rules dispatcher and the context.
// create a walker which walks the tree in a DFS manner while
// maintaining
// the operator stack. The dispatcher
// generates the plan from the operator tree
Map<Rule, NodeProcessor> opRules = new LinkedHashMap<Rule, NodeProcessor>();
opRules.put(new RuleRegExp("R1", Windowing2Parser.NULL + "%"), getNullExprProcessor());
opRules.put(new RuleRegExp("R2", Windowing2Parser.Number + "%|" + Windowing2Parser.TinyintLiteral + "%|" + Windowing2Parser.SmallintLiteral + "%|" + Windowing2Parser.BigintLiteral + "%"), getNumExprProcessor());
opRules.put(new RuleRegExp("R3", Windowing2Parser.Identifier + "%|" + Windowing2Parser.StringLiteral + "%|" + Windowing2Parser.CHARSETLITERAL + "%|" + Windowing2Parser.STRINGLITERALSEQUENCE + "%|" + "%|" + Windowing2Parser.IF + "%|" + Windowing2Parser.CASE + "%|" + Windowing2Parser.WHEN + "%|" + Windowing2Parser.IN + "%|" + Windowing2Parser.ARRAY + "%|" + Windowing2Parser.MAP + "%|" + Windowing2Parser.BETWEEN + "%|" + Windowing2Parser.STRUCT + "%"), getStrExprProcessor());
opRules.put(new RuleRegExp("R4", Windowing2Parser.TRUE + "%|" + Windowing2Parser.FALSE + "%"), getBoolExprProcessor());
opRules.put(new RuleRegExp("R5", Windowing2Parser.TABLEORCOL + "%"), getColumnExprProcessor());
// The dispatcher fires the processor corresponding to the closest
// matching
// rule and passes the context along
Dispatcher disp = new DefaultRuleDispatcher(getDefaultExprProcessor(), opRules, tcCtx);
GraphWalker ogw = new DefaultGraphWalker(disp);
// Create a list of topop nodes
ArrayList<Node> topNodes = new ArrayList<Node>();
topNodes.add(expr);
HashMap<Node, Object> nodeOutputs = new HashMap<Node, Object>();
ogw.startWalking(topNodes, nodeOutputs);
return nodeOutputs;
}
use of java.util.LinkedHashMap in project j2objc by google.
the class LinkedHashMapTest method test_values.
/**
* java.util.LinkedHashMap#values()
*/
public void test_values() {
// Test for method java.util.Collection java.util.LinkedHashMap.values()
Collection c = hm.values();
assertTrue("Returned collection of incorrect size()", c.size() == hm.size());
for (int i = 0; i < objArray.length; i++) assertTrue("Returned collection does not contain all keys", c.contains(objArray[i]));
LinkedHashMap myLinkedHashMap = new LinkedHashMap();
for (int i = 0; i < 100; i++) myLinkedHashMap.put(objArray2[i], objArray[i]);
Collection values = myLinkedHashMap.values();
new Support_UnmodifiableCollectionTest("Test Returned Collection From LinkedHashMap.values()", values).runTest();
values.remove(new Integer(0));
assertTrue("Removing from the values collection should remove from the original map", !myLinkedHashMap.containsValue(new Integer(0)));
}
use of java.util.LinkedHashMap in project j2objc by google.
the class LinkedHashMapTest method test_clone.
/**
* java.util.LinkedHashMap#clone()
*/
public void test_clone() {
// Test for method java.lang.Object java.util.LinkedHashMap.clone()
LinkedHashMap hm2 = (LinkedHashMap) hm.clone();
assertTrue("Clone answered equivalent LinkedHashMap", hm2 != hm);
for (int counter = 0; counter < hmSize; counter++) assertTrue("Clone answered unequal LinkedHashMap", hm.get(objArray2[counter]) == hm2.get(objArray2[counter]));
LinkedHashMap map = new LinkedHashMap();
map.put("key", "value");
// get the keySet() and values() on the original Map
Set keys = map.keySet();
Collection values = map.values();
assertEquals("values() does not work", "value", values.iterator().next());
assertEquals("keySet() does not work", "key", keys.iterator().next());
AbstractMap map2 = (AbstractMap) map.clone();
map2.put("key", "value2");
Collection values2 = map2.values();
assertTrue("values() is identical", values2 != values);
// values() and keySet() on the cloned() map should be different
assertEquals("values() was not cloned", "value2", values2.iterator().next());
map2.clear();
map2.put("key2", "value3");
Set key2 = map2.keySet();
assertTrue("keySet() is identical", key2 != keys);
assertEquals("keySet() was not cloned", "key2", key2.iterator().next());
}
use of java.util.LinkedHashMap in project j2objc by google.
the class LinkedHashMapTest method test_clone_Mock.
// regresion test for HARMONY-4603
public void test_clone_Mock() {
LinkedHashMap hashMap = new MockMap();
String value = "value a";
hashMap.put("key", value);
MockMap cloneMap = (MockMap) hashMap.clone();
assertEquals(value, cloneMap.get("key"));
assertEquals(hashMap, cloneMap);
assertEquals(1, cloneMap.num);
hashMap.put("key", "value b");
assertFalse(hashMap.equals(cloneMap));
}
use of java.util.LinkedHashMap in project j2objc by google.
the class LinkedHashMapTest method test_getLjava_lang_Object.
/**
* java.util.LinkedHashMap#get(java.lang.Object)
*/
public void test_getLjava_lang_Object() {
// Test for method java.lang.Object
// java.util.LinkedHashMap.get(java.lang.Object)
assertNull("Get returned non-null for non existent key", hm.get("T"));
hm.put("T", "HELLO");
assertEquals("Get returned incorecct value for existing key", "HELLO", hm.get("T"));
LinkedHashMap m = new LinkedHashMap();
m.put(null, "test");
assertEquals("Failed with null key", "test", m.get(null));
assertNull("Failed with missing key matching null hash", m.get(new Integer(0)));
}
Aggregations