Created
June 20, 2013 13:16
-
-
Save christophe-dooapp/5822568 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 DoubleBinding averageBinding = new DoubleBinding() { | |
{ | |
//call #computeValue every time #values() changes | |
super.bind(values()); | |
} | |
@Override | |
protected double computeValue() { | |
double result = 0; | |
if (values().isEmpty()) { | |
return result; | |
} | |
for (Double d : values()) { | |
result += d; | |
} | |
return result / values().size(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment