Mercurial > hg > Members > nobuyasu > Consensus
diff app/models/TPGraph.java @ 82:cddb5ed942a6 draft
modified copyConsensusTree method
author | one |
---|---|
date | Sat, 09 Mar 2013 21:26:40 +0900 |
parents | f744331287ea |
children | c6929060c85f |
line wrap: on
line diff
--- a/app/models/TPGraph.java Fri Mar 08 21:12:37 2013 +0900 +++ b/app/models/TPGraph.java Sat Mar 09 21:26:40 2013 +0900 @@ -210,8 +210,6 @@ } return set.toArray(); } - - /* * Return CLAIM numbers of above [id] CLAIM. @@ -255,32 +253,30 @@ return v; } - private void recursiveCopyDownClaimsAndSetLabel(ClaimModel oldUpClaim, ClaimModel latestUpClaim, String... labels) { + private void recursiveCopyDownClaimsAndSetLabel(ClaimModel oldUpClaim, ClaimModel latestUpClaim, + String timestamp, String... labels) { for (String label: labels) { GremlinPipeline<Vertex, Vertex> pipe = new GremlinPipeline<Vertex, Vertex>(); pipe.start(oldUpClaim.getVertex()).out(label); for (Vertex oldDownV : pipe) { ClaimModel oldDownClaim = new ClaimModel(oldDownV); - ClaimModel latestDownClaim = oldDownClaim.cloneAndSetLabelPrev(); + ClaimModel latestDownClaim = oldDownClaim.cloneAndSetLabelPrev(timestamp); setLabel(latestUpClaim.getVertex(), latestDownClaim.getVertex(), label); - recursiveCopyDownClaimsAndSetLabel(oldDownClaim, latestDownClaim, labels); + recursiveCopyDownClaimsAndSetLabel(oldDownClaim, latestDownClaim, timestamp, labels); } } } - private ClaimModel copyDownClaims(ClaimModel oldTopClaim) { - ClaimModel latestTopClaim = oldTopClaim.cloneAndSetLabelPrev(); - recursiveCopyDownClaimsAndSetLabel(oldTopClaim, latestTopClaim, + private ClaimModel copyDownClaims(ClaimModel oldTopClaim, String timestamp) { + ClaimModel latestTopClaim = oldTopClaim.cloneAndSetLabelPrev(timestamp); + recursiveCopyDownClaimsAndSetLabel(oldTopClaim, latestTopClaim, timestamp, NodeModel.L_REFUTATION, NodeModel.L_QUESTION, NodeModel.L_SUGGESTION); return latestTopClaim; } - /* - * TODO: update TimeStamp - */ - public ClaimModel copyConsensusTree(ClaimModel claim) { + public ClaimModel copyConsensusTree(ClaimModel claim, String timestamp) { ClaimModel oldTopClaim = new ClaimModel(getVertex(getTopClaimVertexId(claim.getId()))); - ClaimModel latestTopClaim = copyDownClaims(oldTopClaim); + ClaimModel latestTopClaim = copyDownClaims(oldTopClaim, timestamp); return latestTopClaim; }