Created
October 5, 2017 06:24
-
-
Save Madusudanan/13a7f69ba2b68d44cde20bd0a224603a to your computer and use it in GitHub Desktop.
Scala pattern matching decompiled - 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Source code recreated from a .class file by IntelliJ IDEA | |
// (powered by Fernflower decompiler) | |
// | |
import RunExample.delayedInit.body; | |
import scala.App; | |
import scala.Function0; | |
import scala.App.class; | |
import scala.collection.mutable.ListBuffer; | |
import scala.runtime.BoxedUnit; | |
public final class RunExample$ implements App { | |
public static final RunExample$ MODULE$; | |
private final double score; | |
private final String scoreFeedback; | |
private final long executionStart; | |
private String[] scala$App$$_args; | |
private final ListBuffer<Function0<BoxedUnit>> scala$App$$initCode; | |
static { | |
new RunExample$(); | |
} | |
public long executionStart() { | |
return this.executionStart; | |
} | |
public String[] scala$App$$_args() { | |
return this.scala$App$$_args; | |
} | |
public void scala$App$$_args_$eq(String[] x$1) { | |
this.scala$App$$_args = x$1; | |
} | |
public ListBuffer<Function0<BoxedUnit>> scala$App$$initCode() { | |
return this.scala$App$$initCode; | |
} | |
public void scala$App$_setter_$executionStart_$eq(long x$1) { | |
this.executionStart = x$1; | |
} | |
public void scala$App$_setter_$scala$App$$initCode_$eq(ListBuffer x$1) { | |
this.scala$App$$initCode = x$1; | |
} | |
public String[] args() { | |
return class.args(this); | |
} | |
/** @deprecated */ | |
public void delayedInit(Function0<BoxedUnit> body) { | |
class.delayedInit(this, body); | |
} | |
public void main(String[] args) { | |
class.main(this, args); | |
} | |
public double score() { | |
return this.score; | |
} | |
public String scoreFeedback() { | |
return this.scoreFeedback; | |
} | |
public final void delayedEndpoint$RunExample$1() { | |
this.score = 8.0D; | |
double var1 = this.score(); | |
String var3; | |
if(var1 >= 8.0D && var1 <= 10.0D) { | |
var3 = "High score"; | |
} else if(var1 >= 5.0D && var1 < 8.0D) { | |
var3 = "Average score"; | |
} else if(var1 >= 0.0D && var1 < 5.0D) { | |
var3 = "Low score"; | |
} else { | |
var3 = "Error. Invalid score. It has to be in the range 0.0 to 10.0"; | |
} | |
this.scoreFeedback = var3; | |
} | |
private RunExample$() { | |
MODULE$ = this; | |
class.$init$(this); | |
this.delayedInit(new body(this)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object RunExample extends App { | |
val score = 8.0 | |
val scoreFeedback = score match { | |
case highScore | |
if highScore >= 8.0 && highScore <= 10.0 => | |
"High score" | |
case averageScore | |
if averageScore >= 5.0 && averageScore < 8.0 => | |
"Average score" | |
case lowScore | |
if lowScore >=0.0 && lowScore < 5.0 => | |
"Low score" | |
case _ => | |
"Error. Invalid score. It has to be in the range 0.0 to 10.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment