1
0

First Workin Matrix Test

This commit is contained in:
Andreas Stadelmeier 2024-06-10 08:57:04 +02:00
parent 536fe9239e
commit d82c4d3ebf
8 changed files with 657 additions and 15 deletions

View File

@ -53,7 +53,6 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerArgs>--enable-preview</compilerArgs>
<source>21</source>
<target>21</target>
</configuration>

View File

@ -1,8 +1,11 @@
grammar ConstraintSet;
constraintSet : (constraints | orConstraint)+;
constraintSet : (constraints | orConstraint | extendsRelation)+;
orConstraint : '{' constraints ('|' constraints)+ '}';
extendsRelation: IDENTIFIER typeParams? '<' type;
typeParams : '<' IDENTIFIER (',' IDENTIFIER)* '>';
orConstraint : '{' constraints ('|' constraints)* '}';
constraints : '{' constraint+ '}' | constraint+;
constraint: subtypeCons | equalsCons;
@ -10,12 +13,11 @@ subtypeCons : type '<.' type;
equalsCons : type '=.' type;
type : tph | namedType;
tph : LOWERCASELETTER IDENTIFIER?;
tph : '_' IDENTIFIER;
namedType : IDENTIFIER params?;
params : '<' type (',' type)* '>';
LOWERCASELETTER : [a-z];
IDENTIFIER: (LOWERCASELETTER | [A-Z])+;
IDENTIFIER: [A-Za-z.]+;
KOMMA : ',' -> skip;
NEWLINE : [\r\n]+ -> skip;

View File

@ -1,5 +1,35 @@
% TEST INPUT
orCons(undCons(equalsdot(tph("e"),type("bj",null)),undCons(lessdot(tph("e"),type("Integer",null)),undCons(lessdot(tph("p"),tph("l")),undCons(equalsdot(type("Boolean",null),tph("g")),undCons(equalsdot(tph("t"),type("bc",null)),undCons(lessdot(type("Vector",params(type("Integer",null))),tph("r")),undCons(lessdot(tph("f"),tph("e")), null))))))), null).
orCons(undCons(lessdot(tph("_BG"),type("java.lang.Number",null)),undCons(equalsdot(tph("_BE"),type("java.lang.Boolean",null)),undCons(equalsdot(type("java.lang.Boolean",null),tph("_AH")),undCons(lessdot(tph("_BC"),type("java.lang.Number",null)),undCons(lessdot(tph("_G"),type("java.lang.Integer",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_AS")),undCons(equalsdot(type("java.lang.Boolean",null),tph("_H")),undCons(lessdot(tph("_AP"),tph("_AM")),undCons(lessdot(tph("_AV"),tph("_AU")),undCons(equalsdot(tph("_AI"),type("Matrix",null)),undCons(lessdot(tph("_AD"),tph("_AB")),undCons(lessdot(type("Matrix",null),tph("_AD")),undCons(lessdot(tph("_AF"),type("java.lang.Number",null)),undCons(equalsdot(tph("_AU"),tph("_CD")),undCons(equalsdot(tph("_H"),type("java.lang.Boolean",null)),undCons(lessdot(tph("_BV"),tph("_BA")),undCons(lessdot(tph("_V"),type("java.lang.Integer",null)),undCons(lessdot(tph("_J"),type("java.lang.Number",null)),undCons(lessdot(tph("_AY"),type("java.lang.Number",null)),undCons(equalsdot(tph("_AH"),type("java.lang.Boolean",null)),undCons(equalsdot(type("java.lang.Boolean",null),tph("_BE")),undCons(equalsdot(tph("_AF"),tph("_CK")),undCons(equalsdot(type("java.lang.Boolean",null),tph("_AW")),undCons(lessdot(tph("_AU"),type("java.lang.Number",null)),undCons(lessdot(tph("_BD"),tph("_BC")),undCons(equalsdot(tph("_AW"),type("java.lang.Boolean",null)),undCons(lessdot(tph("_BB"),tph("_BA")),undCons(lessdot(tph("_AG"),tph("_AF")),undCons(equalsdot(tph("_S"),type("Matrix",null)),undCons(equalsdot(type("java.util.Vector",params(type("java.util.Vector",params(type("java.lang.Integer",null))))),type("java.util.Vector",params(tph("_ANQ")))),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Number",null)),undCons(equalsdot(type("java.util.Vector",params(type("java.util.Vector",params(type("java.lang.Integer",null))))),type("java.util.Vector",params(tph("_ANR")))),undCons(equalsdot(tph("_BC"),tph("_BW")),undCons(equalsdot(tph("_AQ"),type("Matrix",null)),undCons(lessdot(tph("_AK"),type("java.lang.Number",null)), null))))))))))))))))))))))))))))))))))), null).
orCons(undCons(equalsdot(tph("_AE"),type("Matrix",null)),undCons(lessdot(type("Matrix",null),type("Matrix",null)), null)), null).
orCons(undCons(equalsdot(tph("_AG"),type("java.lang.Integer",null)), null), null).
orCons(undCons(equalsdot(tph("_AI"),type("java.util.AbstractList",params(tph("_AMV")))),undCons(lessdot(type("java.lang.Integer",null),tph("_AK")), null)),orCons(undCons(equalsdot(tph("_AI"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),tph("_AK")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AK")),undCons(equalsdot(tph("_AI"),type("java.util.List",params(tph("_AMU")))), null)),orCons(undCons(equalsdot(tph("_AI"),type("java.util.AbstractList",params(tph("_AMV")))),undCons(lessdot(type("java.lang.Integer",null),tph("_AK")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AK")),undCons(equalsdot(tph("_AI"),type("java.util.Vector",params(tph("_AMW")))), null)),orCons(undCons(equalsdot(tph("_AI"),type("java.util.List",params(tph("_AMU")))),undCons(lessdot(type("java.lang.Integer",null),tph("_AK")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AK")),undCons(equalsdot(tph("_AI"),type("java.util.Vector",params(tph("_AMW")))), null)),orCons(undCons(equalsdot(tph("_AI"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),tph("_AK")), null)), null)))))))).
orCons(undCons(lessdot(tph("_AF"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AQ"),type("java.util.Vector",params(tph("_AMX")))),undCons(lessdot(tph("_AMX"),tph("_AP")), null))),orCons(undCons(lessdot(tph("_AF"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AQ"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_AP")), null))),orCons(undCons(lessdot(tph("_AF"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AQ"),type("java.util.Vector",params(tph("_AMX")))),undCons(lessdot(tph("_AMX"),tph("_AP")), null))),orCons(undCons(lessdot(tph("_AF"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AQ"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_AP")), null))), null)))).
orCons(undCons(lessdot(type("java.util.Vector",params(tph("_AMY"))),type("java.util.Vector",params(type("java.lang.Integer",null)))),undCons(equalsdot(tph("_AT"),type("java.util.Vector",params(type("GE",null)))), null)), null).
orCons(undCons(equalsdot(tph("_AV"),type("java.lang.Integer",null)), null), null).
orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("Matrix",null)), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("java.util.List",params(tph("_AMZ")))), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("java.util.Vector",params(tph("_ANB")))), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("java.util.List",params(tph("_AMZ")))), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("java.util.AbstractList",params(tph("_ANA")))), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("java.util.AbstractList",params(tph("_ANA")))), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("Matrix",null)), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_AY")),undCons(equalsdot(tph("_AM"),type("java.util.Vector",params(tph("_ANB")))), null)), null)))))))).
orCons(undCons(equalsdot(tph("_BB"),type("java.lang.Integer",null)), null), null).
orCons(undCons(equalsdot(tph("_BD"),type("java.lang.Integer",null)), null), null).
orCons(undCons(equalsdot(tph("_AM"),type("java.util.Vector",params(tph("_ANE")))),undCons(lessdot(type("java.lang.Integer",null),tph("_BG")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_BG")),undCons(equalsdot(tph("_AM"),type("Matrix",null)), null)),orCons(undCons(equalsdot(tph("_AM"),type("java.util.Vector",params(tph("_ANE")))),undCons(lessdot(type("java.lang.Integer",null),tph("_BG")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_BG")),undCons(equalsdot(tph("_AM"),type("java.util.AbstractList",params(tph("_AND")))), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_BG")),undCons(equalsdot(tph("_AM"),type("Matrix",null)), null)),orCons(undCons(equalsdot(tph("_AM"),type("java.util.List",params(tph("_ANC")))),undCons(lessdot(type("java.lang.Integer",null),tph("_BG")), null)),orCons(undCons(equalsdot(tph("_AM"),type("java.util.List",params(tph("_ANC")))),undCons(lessdot(type("java.lang.Integer",null),tph("_BG")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_BG")),undCons(equalsdot(tph("_AM"),type("java.util.AbstractList",params(tph("_AND")))), null)), null)))))))).
orCons(undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_BK")),undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AM"),type("Matrix",null)), null))),orCons(undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_BK")),undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AM"),type("Matrix",null)), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANG"),tph("_BK")),undCons(equalsdot(tph("_AM"),type("java.util.AbstractList",params(tph("_ANG")))), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AM"),type("java.util.Vector",params(tph("_ANH")))),undCons(lessdot(tph("_ANH"),tph("_BK")), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANG"),tph("_BK")),undCons(equalsdot(tph("_AM"),type("java.util.AbstractList",params(tph("_ANG")))), null))),orCons(undCons(lessdot(tph("_ANF"),tph("_BK")),undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AM"),type("java.util.List",params(tph("_ANF")))), null))),orCons(undCons(lessdot(tph("_ANF"),tph("_BK")),undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AM"),type("java.util.List",params(tph("_ANF")))), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANH"),tph("_BK")),undCons(equalsdot(tph("_AM"),type("java.util.Vector",params(tph("_ANH")))), null))), null)))))))).
orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANI"),tph("_BR")),undCons(equalsdot(tph("_AC"),type("java.util.List",params(tph("_ANI")))), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AC"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_BR")), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_AC"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_BR")), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANJ"),tph("_BR")),undCons(equalsdot(tph("_AC"),type("java.util.AbstractList",params(tph("_ANJ")))), null))),orCons(undCons(equalsdot(tph("_AC"),type("java.util.Vector",params(tph("_ANK")))),undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANK"),tph("_BR")), null))),orCons(undCons(equalsdot(tph("_AC"),type("java.util.Vector",params(tph("_ANK")))),undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANK"),tph("_BR")), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANI"),tph("_BR")),undCons(equalsdot(tph("_AC"),type("java.util.List",params(tph("_ANI")))), null))),orCons(undCons(lessdot(tph("_BC"),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANJ"),tph("_BR")),undCons(equalsdot(tph("_AC"),type("java.util.AbstractList",params(tph("_ANJ")))), null))), null)))))))).
orCons(undCons(lessdot(tph("_ANM"),tph("_BO")),undCons(equalsdot(tph("_BR"),type("java.util.AbstractList",params(tph("_ANM")))),undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)), null))),orCons(undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_BR"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_BO")), null))),orCons(undCons(equalsdot(tph("_BR"),type("java.util.List",params(tph("_ANL")))),undCons(lessdot(tph("_ANL"),tph("_BO")),undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)), null))),orCons(undCons(equalsdot(tph("_BR"),type("java.util.List",params(tph("_ANL")))),undCons(lessdot(tph("_ANL"),tph("_BO")),undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)), null))),orCons(undCons(lessdot(tph("_ANN"),tph("_BO")),undCons(equalsdot(tph("_BR"),type("java.util.Vector",params(tph("_ANN")))),undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)), null))),orCons(undCons(lessdot(tph("_ANM"),tph("_BO")),undCons(equalsdot(tph("_BR"),type("java.util.AbstractList",params(tph("_ANM")))),undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)), null))),orCons(undCons(lessdot(tph("_ANN"),tph("_BO")),undCons(equalsdot(tph("_BR"),type("java.util.Vector",params(tph("_ANN")))),undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)), null))),orCons(undCons(lessdot(tph("_AU"),type("java.lang.Integer",null)),undCons(equalsdot(tph("_BR"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_BO")), null))), null)))))))).
orCons(undCons(lessdot(tph("_BO"),type("java.lang.Integer",null)),undCons(equalsdot(type("java.lang.Integer",null),tph("_BU")),undCons(lessdot(tph("_BK"),type("java.lang.Integer",null)), null))), null).
orCons(undCons(lessdot(tph("_BU"),type("java.lang.Integer",null)),undCons(lessdot(tph("_BA"),type("java.lang.Integer",null)),undCons(equalsdot(type("java.lang.Integer",null),tph("_BV")), null))), null).
orCons(undCons(lessdot(tph("_BA"),type("java.util.Vector",params(type("java.lang.Integer",null)))),undCons(equalsdot(tph("_AS"),type("Matrix",null)), null)),orCons(undCons(lessdot(tph("_BA"),type("java.util.Vector",params(type("java.lang.Integer",null)))),undCons(equalsdot(tph("_AS"),type("Matrix",null)), null)),orCons(undCons(equalsdot(tph("_AS"),type("java.util.Vector",params(tph("_ANO")))),undCons(lessdot(tph("_BA"),tph("_ANO")), null)),orCons(undCons(equalsdot(tph("_AS"),type("java.util.Vector",params(tph("_ANO")))),undCons(lessdot(tph("_BA"),tph("_ANO")), null)), null)))).
orCons(undCons(lessdot(tph("_AS"),type("java.util.Vector",params(type("java.lang.Integer",null)))),undCons(equalsdot(tph("_AD"),type("Matrix",null)), null)),orCons(undCons(equalsdot(tph("_AD"),type("java.util.Vector",params(tph("_ANP")))),undCons(lessdot(tph("_AS"),tph("_ANP")), null)),orCons(undCons(lessdot(tph("_AS"),type("java.util.Vector",params(type("java.lang.Integer",null)))),undCons(equalsdot(tph("_AD"),type("Matrix",null)), null)),orCons(undCons(equalsdot(tph("_AD"),type("java.util.Vector",params(tph("_ANP")))),undCons(lessdot(tph("_AS"),tph("_ANP")), null)), null)))).
orCons(undCons(equalsdot(tph("_G"),type("java.lang.Integer",null)), null), null).
orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_J")),undCons(equalsdot(tph("_F"),type("java.util.List",params(tph("_ANS")))), null)),orCons(undCons(equalsdot(tph("_F"),type("java.util.AbstractList",params(tph("_ANT")))),undCons(lessdot(type("java.lang.Integer",null),tph("_J")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_J")),undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANU")))), null)),orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),tph("_J")), null)),orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),tph("_J")), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_J")),undCons(equalsdot(tph("_F"),type("java.util.List",params(tph("_ANS")))), null)),orCons(undCons(lessdot(type("java.lang.Integer",null),tph("_J")),undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANU")))), null)),orCons(undCons(equalsdot(tph("_F"),type("java.util.AbstractList",params(tph("_ANT")))),undCons(lessdot(type("java.lang.Integer",null),tph("_J")), null)), null)))))))).
orCons(undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANV"),tph("_N")),undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANV")))), null))),orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))),orCons(undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANV"),tph("_N")),undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANV")))), null))),orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))), null)))).
orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))),orCons(undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANX")))),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANX"),tph("_N")), null))),orCons(undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANX")))),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANX"),tph("_N")), null))),orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))), null)))).
orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))),orCons(undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))),orCons(undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANZ")))),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANZ"),tph("_N")), null))),orCons(undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_ANZ")))),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(tph("_ANZ"),tph("_N")), null))), null)))).
orCons(undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))),orCons(undCons(lessdot(tph("_AOB"),tph("_N")),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_AOB")))), null))),orCons(undCons(lessdot(tph("_AOB"),tph("_N")),undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(equalsdot(tph("_F"),type("java.util.Vector",params(tph("_AOB")))), null))),orCons(undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(equalsdot(tph("_F"),type("Matrix",null)),undCons(lessdot(type("java.util.Vector",params(type("java.lang.Integer",null))),tph("_N")), null))), null)))).
orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(lessdot(tph("_N"),tph("_AOA")),undCons(equalsdot(tph("_S"),type("java.util.Vector",params(tph("_AOA")))), null))),orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(lessdot(tph("_N"),tph("_ANW")),undCons(equalsdot(tph("_S"),type("java.util.List",params(tph("_ANW")))), null))),orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(lessdot(tph("_N"),tph("_ANW")),undCons(equalsdot(tph("_S"),type("java.util.List",params(tph("_ANW")))), null))),orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(lessdot(tph("_N"),tph("_AOA")),undCons(equalsdot(tph("_S"),type("java.util.Vector",params(tph("_AOA")))), null))),orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(equalsdot(tph("_S"),type("Matrix",null)),undCons(lessdot(tph("_N"),type("java.util.Vector",params(type("java.lang.Integer",null)))), null))),orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(equalsdot(tph("_S"),type("Matrix",null)),undCons(lessdot(tph("_N"),type("java.util.Vector",params(type("java.lang.Integer",null)))), null))),orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(equalsdot(tph("_S"),type("java.util.AbstractList",params(tph("_ANY")))),undCons(lessdot(tph("_N"),tph("_ANY")), null))),orCons(undCons(lessdot(type("java.lang.Boolean",null),tph("_R")),undCons(equalsdot(tph("_S"),type("java.util.AbstractList",params(tph("_ANY")))),undCons(lessdot(tph("_N"),tph("_ANY")), null))), null)))))))).
orCons(undCons(equalsdot(tph("_U"),type("java.lang.Integer",null)), null), null).
orCons(undCons(lessdot(type("java.lang.Integer",null),type("java.lang.Integer",null)),undCons(lessdot(tph("_U"),type("java.lang.Integer",null)),undCons(equalsdot(type("java.lang.Integer",null),tph("_V")), null))), null).
super(type("java.lang.Boolean",null),type("Object",null)):-super(type("java.lang.Boolean",null)).super(type("java.lang.Integer",null),type("java.lang.Number",null)):-super(type("java.lang.Integer",null)).super(type("java.lang.Number",null),type("Object",null)):-super(type("java.lang.Number",null)).super(type("java.util.Vector",params(XX)),type("Object",null)):-super(type("java.util.Vector",params(XX))).super(type("Matrix",null),type("java.util.Vector",params(type("java.util.Vector",params(type("java.lang.Integer",null)))))):-super(type("Matrix",null)).
%%%%%
super(type("MyPair", params(X, Y)), type("Pair", params(Y, X))) :- super(type("MyPair", params(X, Y))).
@ -18,8 +48,6 @@ less(A,B) :- super(type(A, AP), type(B, BP)).
% Or-Constraints
undCons(A,B) :- orCons(undCons(A,B), null).
undCons(A,B); orCons(C,D) :- orCons(undCons(A,B), orCons(C,D)).
undCons(A,B); undCons(C,D) :- orCons(undCons(A,B), undCons(C,D)).
lessdot(A,B); lessdot(C,D) :- orCons(lessdot(A,B), lessdot(C,D)).
lessdot(A,B) :- undCons(lessdot(A,B), _).
undCons(B,C) :- undCons(A, undCons(B, C)).

View File

@ -6,6 +6,7 @@ import de.dhbwstuttgart.sat.asp.*;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import java.util.ArrayList;
import java.util.List;
@ -13,6 +14,23 @@ import java.util.Set;
import java.util.stream.Collectors;
public class ConstraintParser {
public static List<ExtendsRelation> parseExtendsRelations(String cons){
CharStream input = CharStreams.fromString(cons);
de.dhbwstuttgart.input.parser.ConstraintSetLexer lexer = new ConstraintSetLexer(input);
CommonTokenStream tokens = new CommonTokenStream(lexer);
ConstraintSetParser parser = new ConstraintSetParser(tokens);
ConstraintSetParser.ConstraintSetContext conSet = parser.constraintSet(); //Parsen
List<ExtendsRelation> ret = new ArrayList<>();
for(var ext : conSet.extendsRelation()){
if(ext.typeParams()!=null){
ret.add(new ExtendsRelation(ext.IDENTIFIER().getText(), ext.typeParams().IDENTIFIER().stream().map(x -> new TypeParameter(x.getText())).toList(), (NamedType) parseType(ext.type())));
}else{
ret.add(new ExtendsRelation(ext.IDENTIFIER().getText(), List.of(), (NamedType) parseType(ext.type())));
}
}
return ret;
}
public static List<List<Set<Pair>>> parse(String cons){
CharStream input = CharStreams.fromString(cons);
de.dhbwstuttgart.input.parser.ConstraintSetLexer lexer = new ConstraintSetLexer(input);
@ -22,7 +40,7 @@ public static List<List<Set<Pair>>> parse(String cons){
Set<Pair> undCons = conSet.constraints().stream().flatMap(c -> parseUndConstraint(c).stream()).collect(Collectors.toSet());
var ret = new ArrayList<List<Set<Pair>>>();
var orCons = conSet.orConstraint().stream().map(ConstraintParser::parseOrConstraint).toList();
ret.add(List.of(undCons));
if(undCons.size() > 0)ret.add(List.of(undCons));
ret.addAll(orCons);
return ret;
}

View File

@ -1,5 +1,6 @@
package de.dhbwstuttgart.sat.asp;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@ -14,12 +15,11 @@ public class ASPGenerator {
}
public static String generateOrCons(List<Set<Pair>> undCon){
if(undCon.size() == 1){
return "orCons(" + generateUndCons(undCon.iterator().next()) + ", null)";
if(undCon.size() < 2){
return "orCons(" + generateUndCons(undCon.getFirst()) + ", null)";
}else {
// undCOns verschachteln
Set<Pair> first = undCon.get(0);
undCon = undCon.stream().filter(x->!first.equals(x)).collect(Collectors.toList());
Set<Pair> first = undCon.getFirst();
undCon = undCon.subList(1, undCon.size());
return "orCons(" + generateUndCons(first) + ","+ generateOrCons(undCon) + ")";
}/*
String ret = "orCons(";
@ -42,4 +42,12 @@ public class ASPGenerator {
}
}
public static String generateExtendsRelations(List<ExtendsRelation> extendsRelations) {
String ret = "";
for(var x : extendsRelations){
NamedType subtype = new NamedType(x.subtypeName(), x.subtypeParams().stream().map(i -> (Type)i).toList());
ret += "super("+subtype.toASP()+","+x.superType().toASP()+"):-super("+subtype.toASP()+").";
}
return ret;
}
}

View File

@ -0,0 +1,6 @@
package de.dhbwstuttgart.sat.asp;
import java.util.List;
public record ExtendsRelation(String subtypeName, List<TypeParameter> subtypeParams, NamedType superType) {
}

View File

@ -0,0 +1,8 @@
package de.dhbwstuttgart.sat.asp;
public record TypeParameter(String name) implements Type{
@Override
public String toASP() {
return "X"+name;
}
}

View File

@ -29,6 +29,579 @@ public class UnifyTest {
System.out.println(ASPGenerator.generateASP(ConstraintParser.parse(input)));
}
@Test
public void extendsRelationParserTest(){
String input = "Matrix < Vector<Vector<Integer>>," +
"Vector<X> < List<X>," +
"MyPair<X,Y> < Pair<X,X>," +
"Pair<X,Y> < Object," +
"List<X> < Object";
System.out.println(ASPGenerator.generateExtendsRelations(ConstraintParser.parseExtendsRelations(input)));
//TODO: Finish Extends Relation parser
}
@Test
public void matrix(){
String input = "java.lang.Boolean < Object," +
"java.lang.Integer < java.lang.Number," +
"java.lang.Number < Object," + //TODO: Implement smaller
"java.util.Vector<X> < Object," +
"Matrix < java.util.Vector<java.util.Vector<java.lang.Integer>>\n" +
"_BE=.java.lang.Boolean\n" +
"java.util.Vector<java.util.Vector<java.lang.Integer>>=.java.util.Vector<_ANR>\n" +
"_AU<.java.lang.Number\n" +
"java.util.Vector<java.lang.Integer><._AS\n" +
"_AI=.Matrix\n" +
"_AF=._CK\n" +
"_AP<._AM\n" +
"_BC<.java.lang.Number\n" +
"java.util.Vector<java.util.Vector<java.lang.Integer>>=.java.util.Vector<_ANQ>\n" +
"_S=.Matrix\n" +
"_BD<._BC\n" +
"_AV<._AU\n" +
"_AU<.java.lang.Number\n" +
"_BV<._BA\n" +
"Matrix<._AD\n" +
"_J<.java.lang.Number\n" +
"java.lang.Boolean=._AH\n" +
"_V<.java.lang.Integer\n" +
"_AY<.java.lang.Number\n" +
"_BC=._BW\n" +
"_AK<.java.lang.Number\n" +
"_AH=.java.lang.Boolean\n" +
"_BC<.java.lang.Number\n" +
"_AQ=.Matrix\n" +
"_G<.java.lang.Integer\n" +
"java.lang.Integer<.java.lang.Number\n" +
"_AF<.java.lang.Number\n" +
"_AW=.java.lang.Boolean\n" +
"_BB<._BA\n" +
"java.lang.Boolean=._AW\n" +
"java.lang.Boolean=._H\n" +
"_H=.java.lang.Boolean\n" +
"_AD<._AB\n" +
"_AF<.java.lang.Number\n" +
"_BG<.java.lang.Number\n" +
"java.lang.Boolean=._BE\n" +
"_AU=._CD\n" +
"_AG<._AF\n" +
"{\n" +
"{\n" +
"Matrix<.Matrix\n" +
"_AE=.Matrix\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AG=.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AI=.java.util.AbstractList<_AMV>\n" +
"java.lang.Integer<._AK\n" +
"}\n" +
"|{\n" +
"_AI=.Matrix\n" +
"java.lang.Integer<._AK\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._AK\n" +
"_AI=.java.util.List<_AMU>\n" +
"}\n" +
"|{\n" +
"_AI=.java.util.AbstractList<_AMV>\n" +
"java.lang.Integer<._AK\n" +
"}\n" +
"|{\n" +
"_AI=.java.util.Vector<_AMW>\n" +
"java.lang.Integer<._AK\n" +
"}\n" +
"|{\n" +
"_AI=.java.util.List<_AMU>\n" +
"java.lang.Integer<._AK\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._AK\n" +
"_AI=.java.util.Vector<_AMW>\n" +
"}\n" +
"|{\n" +
"_AI=.Matrix\n" +
"java.lang.Integer<._AK\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AF<.java.lang.Integer\n" +
"_AQ=.java.util.Vector<_AMX>\n" +
"_AMX<._AP\n" +
"}\n" +
"|{\n" +
"_AF<.java.lang.Integer\n" +
"java.util.Vector<java.lang.Integer><._AP\n" +
"_AQ=.Matrix\n" +
"}\n" +
"|{\n" +
"_AF<.java.lang.Integer\n" +
"_AQ=.java.util.Vector<_AMX>\n" +
"_AMX<._AP\n" +
"}\n" +
"|{\n" +
"java.util.Vector<java.lang.Integer><._AP\n" +
"_AF<.java.lang.Integer\n" +
"_AQ=.Matrix\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AT=.java.util.Vector<GE>\n" +
"java.util.Vector<_AMY><.java.util.Vector<java.lang.Integer>\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AV=.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AM=.Matrix\n" +
"java.lang.Integer<._AY\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._AY\n" +
"_AM=.java.util.List<_AMZ>\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._AY\n" +
"_AM=.java.util.Vector<_ANB>\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.List<_AMZ>\n" +
"java.lang.Integer<._AY\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._AY\n" +
"_AM=.java.util.AbstractList<_ANA>\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.AbstractList<_ANA>\n" +
"java.lang.Integer<._AY\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._AY\n" +
"_AM=.Matrix\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.Vector<_ANB>\n" +
"java.lang.Integer<._AY\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_BB=.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_BD=.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AM=.java.util.Vector<_ANE>\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"|{\n" +
"_AM=.Matrix\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.Vector<_ANE>\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.AbstractList<_AND>\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"|{\n" +
"_AM=.Matrix\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.List<_ANC>\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.List<_ANC>\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.AbstractList<_AND>\n" +
"java.lang.Integer<._BG\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AM=.Matrix\n" +
"_BC<.java.lang.Integer\n" +
"java.util.Vector<java.lang.Integer><._BK\n" +
"}\n" +
"|{\n" +
"_AM=.Matrix\n" +
"java.util.Vector<java.lang.Integer><._BK\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_ANG<._BK\n" +
"_AM=.java.util.AbstractList<_ANG>\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.Vector<_ANH>\n" +
"_BC<.java.lang.Integer\n" +
"_ANH<._BK\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.AbstractList<_ANG>\n" +
"_ANG<._BK\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.List<_ANF>\n" +
"_ANF<._BK\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_AM=.java.util.List<_ANF>\n" +
"_ANF<._BK\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_ANH<._BK\n" +
"_BC<.java.lang.Integer\n" +
"_AM=.java.util.Vector<_ANH>\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_ANI<._BR\n" +
"_AC=.java.util.List<_ANI>\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_AC=.Matrix\n" +
"java.util.Vector<java.lang.Integer><._BR\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_AC=.Matrix\n" +
"_BC<.java.lang.Integer\n" +
"java.util.Vector<java.lang.Integer><._BR\n" +
"}\n" +
"|{\n" +
"_ANJ<._BR\n" +
"_AC=.java.util.AbstractList<_ANJ>\n" +
"_BC<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_BC<.java.lang.Integer\n" +
"_AC=.java.util.Vector<_ANK>\n" +
"_ANK<._BR\n" +
"}\n" +
"|{\n" +
"_AC=.java.util.Vector<_ANK>\n" +
"_BC<.java.lang.Integer\n" +
"_ANK<._BR\n" +
"}\n" +
"|{\n" +
"_BC<.java.lang.Integer\n" +
"_AC=.java.util.List<_ANI>\n" +
"_ANI<._BR\n" +
"}\n" +
"|{\n" +
"_AC=.java.util.AbstractList<_ANJ>\n" +
"_BC<.java.lang.Integer\n" +
"_ANJ<._BR\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_BR=.java.util.AbstractList<_ANM>\n" +
"_ANM<._BO\n" +
"_AU<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"java.util.Vector<java.lang.Integer><._BO\n" +
"_AU<.java.lang.Integer\n" +
"_BR=.Matrix\n" +
"}\n" +
"|{\n" +
"_AU<.java.lang.Integer\n" +
"_ANL<._BO\n" +
"_BR=.java.util.List<_ANL>\n" +
"}\n" +
"|{\n" +
"_AU<.java.lang.Integer\n" +
"_BR=.java.util.List<_ANL>\n" +
"_ANL<._BO\n" +
"}\n" +
"|{\n" +
"_ANN<._BO\n" +
"_BR=.java.util.Vector<_ANN>\n" +
"_AU<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_ANM<._BO\n" +
"_AU<.java.lang.Integer\n" +
"_BR=.java.util.AbstractList<_ANM>\n" +
"}\n" +
"|{\n" +
"_ANN<._BO\n" +
"_BR=.java.util.Vector<_ANN>\n" +
"_AU<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_BR=.Matrix\n" +
"java.util.Vector<java.lang.Integer><._BO\n" +
"_AU<.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_BK<.java.lang.Integer\n" +
"java.lang.Integer=._BU\n" +
"_BO<.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_BU<.java.lang.Integer\n" +
"_BA<.java.lang.Integer\n" +
"java.lang.Integer=._BV\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_BA<.java.util.Vector<java.lang.Integer>\n" +
"_AS=.Matrix\n" +
"}\n" +
"|{\n" +
"_AS=.Matrix\n" +
"_BA<.java.util.Vector<java.lang.Integer>\n" +
"}\n" +
"|{\n" +
"_BA<._ANO\n" +
"_AS=.java.util.Vector<_ANO>\n" +
"}\n" +
"|{\n" +
"_BA<._ANO\n" +
"_AS=.java.util.Vector<_ANO>\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_AS<.java.util.Vector<java.lang.Integer>\n" +
"_AD=.Matrix\n" +
"}\n" +
"|{\n" +
"_AS<._ANP\n" +
"_AD=.java.util.Vector<_ANP>\n" +
"}\n" +
"|{\n" +
"_AS<.java.util.Vector<java.lang.Integer>\n" +
"_AD=.Matrix\n" +
"}\n" +
"|{\n" +
"_AS<._ANP\n" +
"_AD=.java.util.Vector<_ANP>\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_G=.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_F=.java.util.List<_ANS>\n" +
"java.lang.Integer<._J\n" +
"}\n" +
"|{\n" +
"_F=.java.util.AbstractList<_ANT>\n" +
"java.lang.Integer<._J\n" +
"}\n" +
"|{\n" +
"_F=.java.util.Vector<_ANU>\n" +
"java.lang.Integer<._J\n" +
"}\n" +
"|{\n" +
"_F=.Matrix\n" +
"java.lang.Integer<._J\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._J\n" +
"_F=.Matrix\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._J\n" +
"_F=.java.util.List<_ANS>\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._J\n" +
"_F=.java.util.Vector<_ANU>\n" +
"}\n" +
"|{\n" +
"java.lang.Integer<._J\n" +
"_F=.java.util.AbstractList<_ANT>\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_F=.java.util.Vector<_ANV>\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_ANV<._N\n" +
"}\n" +
"|{\n" +
"_F=.Matrix\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"}\n" +
"|{\n" +
"_ANV<._N\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_F=.java.util.Vector<_ANV>\n" +
"}\n" +
"|{\n" +
"_F=.Matrix\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_F=.Matrix\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_F=.java.util.Vector<_ANX>\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_ANX<._N\n" +
"}\n" +
"|{\n" +
"_F=.java.util.Vector<_ANX>\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_ANX<._N\n" +
"}\n" +
"|{\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"_F=.Matrix\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"_F=.Matrix\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_F=.Matrix\n" +
"}\n" +
"|{\n" +
"_F=.java.util.Vector<_ANZ>\n" +
"_ANZ<._N\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"}\n" +
"|{\n" +
"_F=.java.util.Vector<_ANZ>\n" +
"_ANZ<._N\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_F=.Matrix\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"}\n" +
"|{\n" +
"_AOB<._N\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_F=.java.util.Vector<_AOB>\n" +
"}\n" +
"|{\n" +
"_F=.java.util.Vector<_AOB>\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_AOB<._N\n" +
"}\n" +
"|{\n" +
"java.util.Vector<java.lang.Integer><._N\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"_F=.Matrix\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_N<._AOA\n" +
"java.lang.Boolean<._R\n" +
"_S=.java.util.Vector<_AOA>\n" +
"}\n" +
"|{\n" +
"_N<._ANW\n" +
"java.lang.Boolean<._R\n" +
"_S=.java.util.List<_ANW>\n" +
"}\n" +
"|{\n" +
"_S=.java.util.List<_ANW>\n" +
"java.lang.Boolean<._R\n" +
"_N<._ANW\n" +
"}\n" +
"|{\n" +
"_N<._AOA\n" +
"java.lang.Boolean<._R\n" +
"_S=.java.util.Vector<_AOA>\n" +
"}\n" +
"|{\n" +
"_N<.java.util.Vector<java.lang.Integer>\n" +
"java.lang.Boolean<._R\n" +
"_S=.Matrix\n" +
"}\n" +
"|{\n" +
"java.lang.Boolean<._R\n" +
"_S=.Matrix\n" +
"_N<.java.util.Vector<java.lang.Integer>\n" +
"}\n" +
"|{\n" +
"java.lang.Boolean<._R\n" +
"_S=.java.util.AbstractList<_ANY>\n" +
"_N<._ANY\n" +
"}\n" +
"|{\n" +
"java.lang.Boolean<._R\n" +
"_S=.java.util.AbstractList<_ANY>\n" +
"_N<._ANY\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"_U=.java.lang.Integer\n" +
"}\n" +
"}\n" +
"{\n" +
"{\n" +
"java.lang.Integer<.java.lang.Integer\n" +
"java.lang.Integer=._V\n" +
"_U<.java.lang.Integer\n" +
"}\n" +
"}\n";
System.out.println(ASPGenerator.generateASP(ConstraintParser.parse(input)));
System.out.println(ASPGenerator.generateExtendsRelations(ConstraintParser.parseExtendsRelations(input)));
}
@Test
public void matrix2k(){
//und-constraints