Created
April 27, 2013 13:49
-
-
Save anonymous/5473192 to your computer and use it in GitHub Desktop.
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
package Roulette; | |
import java.text.MessageFormat; | |
import java.util.Collection; | |
import java.util.Set; | |
import java.util.Iterator; | |
import java.util.TreeSet; | |
public class Bin{ | |
public TreeSet<Outcome> outcomes; | |
int i =0; | |
Bin(){ | |
outcomes = new TreeSet<Outcome>(); | |
} | |
Bin(Outcome[] outcomes){ | |
this(); | |
for(Outcome anOutcome: outcomes){ | |
add(anOutcome); | |
} | |
} | |
Bin(Collection<Outcome> outcomes){ | |
this(); | |
for(Outcome anOutcome: outcomes){ | |
add(anOutcome); | |
} | |
} | |
void add(Outcome outcome){ | |
this.outcomes.add(outcome); | |
} | |
// public String toString() { | |
// Object[] values= { this.outcomes.toString() }; | |
// String msgTempl= "{0}"; | |
// return MessageFormat.format( msgTempl, values ); | |
// } | |
public String toString(){ | |
String string =""; | |
Iterator it1 =this.outcomes.iterator(); | |
while(it1.hasNext()){ | |
string += "["+it1.next().toString()+"]"; | |
} | |
return string; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment