JavaTXCompilerInJavaTXNoMaven/out/tests/resources/syntaxtreegenerator/PatternMatching.ast
2024-05-02 23:04:07 +02:00

120 lines
1.9 KiB
Plaintext

class Point {
java.lang.Integer x;
java.lang.Integer y;
Point(java.lang.Integer x, java.lang.Integer y){
super(());
this.x = x;
this.y = y;
}
java.lang.Integer x(){
return this.x;
}
java.lang.Integer y(){
return this.y;
}
Point(java.lang.Integer x, java.lang.Integer y){
super(());
this.x = x;
this.y = y;
}
}class Shape {
}class ColoredPoint {
Point pt;
java.lang.String color;
ColoredPoint(Point pt, java.lang.String color){
super(());
this.pt = pt;
this.color = color;
}
Point pt(){
return this.pt;
}
java.lang.String color(){
return this.color;
}
ColoredPoint(Point pt, java.lang.String color){
super(());
this.pt = pt;
this.color = color;
}
}class Rectangle {
ColoredPoint upperLeft;
ColoredPoint lowerRight;
Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){
super(());
this.upperLeft = upperLeft;
this.lowerRight = lowerRight;
}
ColoredPoint upperLeft(){
return this.upperLeft;
}
ColoredPoint lowerRight(){
return this.lowerRight;
}
Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight){
super(());
this.upperLeft = upperLeft;
this.lowerRight = lowerRight;
}
}class Color {
Color(){
super(());
}
Color(){
super(());
}
}class Blue {
Blue(){
super(());
}
Blue(){
super(());
}
}class Red {
Red(){
super(());
}
Red(){
super(());
}
}class PatternMatching {
PatternMatching(){
super(());
}
void printColorOfUpperLeftPoint(Shape shape){
switch(shape){
case Rectangle(ColoredPoint(Point pt, java.lang.String color), ColoredPoint lowerRight):
System.out.println Signature: [TPH, TPH](x: op pt.x Signature: [TPH]() op / color: op color op / lowerRight: op lowerRight);
default:
System.out.println Signature: [TPH, TPH](not a rectangle);
};
return;
}
PatternMatching(){
super(());
}
}