@Test public void testGenericArguments(){ SymTypeExpression teFoo = createGenerics("x.Foo", scope, Lists.newArrayList(teP, teDouble, teInt, teH)); assertTrue(teFoo.isGenericType()); SymTypeOfGenerics teFoo2 = (SymTypeOfGenerics) teFoo; assertEquals(4, teFoo2.getArgumentList().size()); assertEquals(teP,teFoo2.getArgument(0)); assertEquals(teDouble,teFoo2.getArgument(1)); assertEquals(teInt,teFoo2.getArgument(2)); assertEquals(teH,teFoo2.getArgument(3)); List<SymTypeExpression> arguments = teFoo2.getArgumentList(); Object[] args = teFoo2.toArrayArguments(); assertEquals(teP,args[0]); assertEquals(teDouble,args[1]); assertEquals(teInt,args[2]); assertEquals(teH,args[3]); SymTypeExpression[] symArgs = teFoo2.toArrayArguments(new SymTypeExpression[4]); assertEquals(teP,symArgs[0]); assertEquals(teDouble,symArgs[1]); assertEquals(teInt,symArgs[2]); assertEquals(teH,symArgs[3]); List<SymTypeExpression> subList = teFoo2.subListArguments(1,3); assertEquals(2,subList.size()); assertEquals(teDouble,subList.get(0)); assertEquals(teInt,subList.get(1)); assertTrue(teFoo2.containsArgument(teDouble)); assertFalse(teFoo2.containsArgument(teDeep1)); assertTrue(teFoo2.containsAllArguments(subList)); assertEquals(0,teFoo2.indexOfArgument(teP)); assertEquals(0,teFoo2.lastIndexOfArgument(teP)); assertTrue(teFoo2.equalsArguments(teFoo2.getArgumentList())); assertFalse(teFoo2.equalsArguments(subList)); Iterator<SymTypeExpression> it = teFoo2.listIteratorArguments(); int i = 0; while(it.hasNext()){ assertEquals(symArgs[i],it.next()); ++i; } assertEquals(4,i); Iterator<SymTypeExpression> it3 = teFoo2.listIteratorArguments(1); i=0; while(it3.hasNext()){ assertEquals(symArgs[i+1],it3.next()); ++i; } assertEquals(3,i); Iterator<SymTypeExpression> it2 = teFoo2.iteratorArguments(); i = 0; while(it2.hasNext()){ assertEquals(symArgs[i],it2.next()); ++i; } assertEquals(4,i); Spliterator<SymTypeExpression> split = teFoo2.spliteratorArguments(); assertEquals(4,split.getExactSizeIfKnown()); split.forEachRemaining(SymTypeExpression::print); assertEquals(4,teFoo2.sizeArguments()); Stream<SymTypeExpression> stream =teFoo2.streamArguments(); List<SymTypeExpression> list = stream.filter(SymTypeExpression::isTypeConstant) .collect(Collectors.toList()); assertEquals(2,list.size()); assertEquals(teDouble,list.get(0)); assertEquals(teInt,list.get(1)); Stream<SymTypeExpression> parStream = teFoo2.parallelStreamArguments(); List<SymTypeExpression> parList = parStream.filter(SymTypeExpression::isTypeConstant) .collect(Collectors.toList()); assertEquals(2,parList.size()); assertEquals(teDouble,parList.get(0)); assertEquals(teInt,parList.get(1)); assertEquals(teFoo2.getArgumentList().hashCode(),teFoo2.hashCodeArguments()); teFoo2.forEachArguments(SymTypeExpression::deepClone); assertEquals(teP,teFoo2.getArgument(0)); teFoo2.setArgument(2,teDeep2); assertEquals(teDeep2,teFoo2.getArgument(2)); teFoo2.addArgument(teSetA); assertEquals(5, teFoo2.sizeArguments()); assertEquals(teSetA,teFoo2.getArgument(4)); teFoo2.addArgument(3,teArr3); assertEquals(6,teFoo2.sizeArguments()); assertEquals(teArr3,teFoo2.getArgument(3)); teFoo2.removeArgument(teArr3); assertFalse(teFoo2.containsArgument(teArr3)); assertEquals(5,teFoo2.sizeArguments()); teFoo2.removeArgument(4); assertFalse(teFoo2.containsArgument(teSetA)); assertEquals(4,teFoo2.sizeArguments()); assertFalse(teFoo2.isEmptyArguments()); teFoo2.clearArguments(); assertEquals(0,teFoo2.sizeArguments()); assertTrue(teFoo2.isEmptyArguments()); arguments = Lists.newArrayList(teP,teDouble,teInt,teH); teFoo2.setArgumentList(arguments); assertEquals(4, teFoo2.sizeArguments()); assertEquals(teP,teFoo2.getArgument(0)); assertEquals(teDouble,teFoo2.getArgument(1)); assertEquals(teInt,teFoo2.getArgument(2)); assertEquals(teH,teFoo2.getArgument(3)); teFoo2.sortArguments((arg1,arg2) -> arg1.hashCode()+arg2.hashCode()); assertEquals(4,teFoo2.sizeArguments()); teFoo2.setArgumentList(Lists.newArrayList()); assertTrue(teFoo2.isEmptyArguments()); arguments = Lists.newArrayList(teP,teDouble,teInt,teH); teFoo2.addAllArguments(arguments); assertEquals(4, teFoo2.getArgumentList().size()); assertEquals(teP,teFoo2.getArgument(0)); assertEquals(teDouble,teFoo2.getArgument(1)); assertEquals(teInt,teFoo2.getArgument(2)); assertEquals(teH,teFoo2.getArgument(3)); subList = Lists.newArrayList(teP,teH); teFoo2.retainAllArguments(subList); assertEquals(2,teFoo2.sizeArguments()); assertEquals(teP,teFoo2.getArgument(0)); assertEquals(teH,teFoo2.getArgument(1)); teFoo2.removeAllArguments(subList); assertTrue(teFoo2.isEmptyArguments()); arguments = Lists.newArrayList(teP,teDouble,teInt,teH); teFoo2.setArgumentList(arguments); teFoo2.replaceAllArguments(SymTypeExpression::deepClone); assertEquals(4,teFoo2.sizeArguments()); assertTrue(teFoo2.equalsArguments(arguments)); teFoo2.removeIfArgument(SymTypeExpression::isTypeConstant); assertEquals(2,teFoo2.sizeArguments()); }
public boolean isGenericType() { return false; }
SymTypeExpression { public boolean isGenericType() { return false; } }
SymTypeExpression { public boolean isGenericType() { return false; }  }
SymTypeExpression { public boolean isGenericType() { return false; }  abstract String print(); boolean isTypeConstant(); boolean isGenericType(); boolean isTypeVariable(); boolean isArrayType(); boolean isVoidType(); boolean isNullType(); boolean isObjectType(); abstract SymTypeExpression deepClone(); abstract boolean deepEquals(SymTypeExpression sym); List<FunctionSymbol> getMethodList(String methodname); List<FunctionSymbol> getMethodList(String methodName, boolean outerIsType); List<VariableSymbol> getFieldList(String fieldName); List<VariableSymbol> getFieldList(String fieldName, boolean outerIsType); TypeSymbol getTypeInfo(); List<TypeSymbol> getInnerTypeList(String name); }
SymTypeExpression { public boolean isGenericType() { return false; }  abstract String print(); boolean isTypeConstant(); boolean isGenericType(); boolean isTypeVariable(); boolean isArrayType(); boolean isVoidType(); boolean isNullType(); boolean isObjectType(); abstract SymTypeExpression deepClone(); abstract boolean deepEquals(SymTypeExpression sym); List<FunctionSymbol> getMethodList(String methodname); List<FunctionSymbol> getMethodList(String methodName, boolean outerIsType); List<VariableSymbol> getFieldList(String fieldName); List<VariableSymbol> getFieldList(String fieldName, boolean outerIsType); TypeSymbol getTypeInfo(); List<TypeSymbol> getInnerTypeList(String name);  }