Skip to content

Commit

Permalink
added UUID on ball draws
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoaac committed Jul 10, 2015
1 parent 1afb43b commit 3ef175d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
* Represents a balldraw, with generation timestamp, Pool size, Draw itself and
* Represents a balldraw, with generation timestamp, UUID, Pool size, Draw itself and
* algorithm used to generate the draw.
*
* @author Nuno Costa ([email protected])
Expand All @@ -18,12 +19,14 @@ public class BallDraw {
private final Integer pool;
private final List<Integer> draw;
private final DrawAlgorithm algorithm;
private final UUID uid;

public BallDraw(Integer pool, List<Integer> draw, DrawAlgorithm algorithm) {
this.creationDate = Calendar.getInstance().getTime();
this.pool = pool;
this.draw = draw;
this.algorithm = algorithm;
uid = UUID.randomUUID();
}

public Date getCreationDate() {
Expand All @@ -50,6 +53,10 @@ public DrawAlgorithm getAlgorithm() {
public int getSize() {
return this.draw.size();
}

public UUID getUid() {
return this.uid;
}

@Override
public String toString() {
Expand All @@ -59,6 +66,7 @@ public String toString() {
return "BallDraw ["
+ (creationDate != null ? "creationDate=" + sdf.format(creationDate.getTime()) + ", "
: "") + (pool != null ? "pool=" + pool + ", " : "")
+ (uid != null ? "uid=" + uid.toString() : "") + "]"
+ (draw != null ? "size=" + draw.size() : "") + "]"
+ (draw != null ? "draw=" + draw : "") + "]"
+ (algorithm != null ? "algorithm=" + algorithm : "") + "]";
Expand Down

0 comments on commit 3ef175d

Please sign in to comment.