From 9f2702276f5314fcad04da1073f6fa0fa8428d3d Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Thu, 8 Mar 2018 00:03:26 +0100 Subject: [PATCH] Fehler beheben --- src/de/dhbwstuttgart/sat/asp/writer/ASPFactory.java | 5 ++++- test/asp/UnifyWithoutWildcards.java | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/de/dhbwstuttgart/sat/asp/writer/ASPFactory.java b/src/de/dhbwstuttgart/sat/asp/writer/ASPFactory.java index 8afce74c..1777eabd 100644 --- a/src/de/dhbwstuttgart/sat/asp/writer/ASPFactory.java +++ b/src/de/dhbwstuttgart/sat/asp/writer/ASPFactory.java @@ -69,6 +69,9 @@ public class ASPFactory implements TypeVisitor{ String pointer = ASPStringConverter.toConstant(NameGenerator.makeNewName()); Iterator it = pointers.iterator(); String p = pointer; + if(!it.hasNext()){ + return ASPRule.ASP_PARAMLIST_END_POINTER.toString(); + } while (it.hasNext()){ ASPStatement stmt; String type = it.next(); @@ -93,7 +96,7 @@ public class ASPFactory implements TypeVisitor{ params.add(param.acceptTV(this)); } String typeName = ASPStringConverter.toConstant(refType.getName()); - String ruleName = isFCType?ASPRule.ASP_TYPE.toString():ASPRule.ASP_FCTYPE.toString(); + String ruleName = isFCType?ASPRule.ASP_FCTYPE.toString():ASPRule.ASP_TYPE.toString(); ASPStatement stmt = makeStatement(ruleName, pointer, typeName, convertParameterlist(params)); writer.add(stmt); return pointer; diff --git a/test/asp/UnifyWithoutWildcards.java b/test/asp/UnifyWithoutWildcards.java index 2bf74d66..e1afc3c8 100644 --- a/test/asp/UnifyWithoutWildcards.java +++ b/test/asp/UnifyWithoutWildcards.java @@ -27,9 +27,10 @@ public class UnifyWithoutWildcards { @Test public void adapt() throws InterruptedException, IOException, ClassNotFoundException { ConstraintSet testSet = new ConstraintSet<>(); - List list = Arrays.asList(TypePlaceholder.fresh(new NullToken())); - RefType t1 = new RefType(new JavaClassName("asp.UnifyWithoutWildcards$Matrix"), new NullToken()); - RefType t2 = new RefType(new JavaClassName("Vector"), list, new NullToken()); + List list1 = Arrays.asList(TypePlaceholder.fresh(new NullToken())); + List list2 = Arrays.asList(TypePlaceholder.fresh(new NullToken())); + RefType t1 = new RefType(new JavaClassName("asp.UnifyWithoutWildcards$Matrix"), list1, new NullToken()); + RefType t2 = new RefType(new JavaClassName("Vector"), list2, new NullToken()); testSet.addUndConstraint(new Pair(t1, t2, PairOperator.SMALLERDOT)); ResultSet resultSet = run(testSet); System.out.println(resultSet.results);