96 lines
1.4 KiB
Plaintext
96 lines
1.4 KiB
Plaintext
class SwitchStatement {
|
|
|
|
SwitchStatement(){
|
|
super(());
|
|
}
|
|
TPH switchStandard(){
|
|
str = SwitchMe;
|
|
switch(str){
|
|
case java.lang.String s:
|
|
return true;
|
|
|
|
default:
|
|
return false;
|
|
|
|
};
|
|
}
|
|
|
|
TPH switchInteger(){
|
|
i = 5;
|
|
switch(i){
|
|
case java.lang.Integer j:
|
|
case java.lang.String s:
|
|
i = 6;
|
|
break;
|
|
|
|
default:
|
|
i = 0;
|
|
break;
|
|
|
|
};
|
|
return i op 0;
|
|
}
|
|
|
|
TPH guardedPattern(){
|
|
TPH i;
|
|
i = 1;
|
|
switch(i){
|
|
case java.lang.Integer j:
|
|
return true;
|
|
|
|
default:
|
|
return false;
|
|
|
|
};
|
|
}
|
|
|
|
TPH recordPattern(java.lang.Object obj){
|
|
switch(obj){
|
|
case Coordinates(java.lang.Double lat, java.lang.Double lon):
|
|
return true;
|
|
|
|
default:
|
|
return false;
|
|
|
|
};
|
|
}
|
|
|
|
SwitchStatement(){
|
|
super(());
|
|
}
|
|
|
|
}class SwitchExpression {
|
|
|
|
java.lang.Integer x;
|
|
java.lang.Integer y;
|
|
SwitchExpression(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;
|
|
}
|
|
|
|
java.lang.Boolean switchStandard(TPH str){
|
|
return switch(str){
|
|
case java.lang.String s:
|
|
yield true;
|
|
|
|
default:
|
|
yield false;
|
|
|
|
};
|
|
}
|
|
|
|
SwitchExpression(java.lang.Integer x, java.lang.Integer y){
|
|
super(());
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
} |