Last active
July 21, 2016 15:39
-
-
Save tkfx/f511ab2715e34947c00e70d1363ccd24 to your computer and use it in GitHub Desktop.
This file contains 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
private static void calcLine(int a, int b, int from, int to) { | |
Line l = new Line(a, b); | |
for (int x = from; x <= to; x++) { | |
int y = l.getY(x); | |
System.err.println("(" + x + ", " + y + ")"); | |
} | |
} | |
static class Line { | |
public final int a; | |
public final int b; | |
public Line(int a, int b) { | |
this.a = a; | |
this.b = b; | |
} | |
// Inlining | |
public int getY(int x) { | |
return (a * x + b); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment