Mercurial > hg > Members > nobuyasu > Consensus
changeset 69:db075978fcb1 draft
modified computeAndUpdateStatus
author | one |
---|---|
date | Tue, 05 Feb 2013 15:49:44 +0900 |
parents | 20a76bed42d1 |
children | 290a5883ac5e |
files | app/models/ClaimModel.java logs/application.log |
diffstat | 2 files changed, 30 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/app/models/ClaimModel.java Fri Nov 16 07:57:39 2012 +0900 +++ b/app/models/ClaimModel.java Tue Feb 05 15:49:44 2013 +0900 @@ -275,10 +275,10 @@ } private Boolean checkUnanimously(String inverseRefutationStatus, - String queAndSugStatus, long requestsNumber, long agreedNumber, + String questionsStatus, long requestsNumber, long agreedNumber, long deniedNumber) { String preStatus = getProperty(STATUS).toString(); - if (inverseRefutationStatus == null && queAndSugStatus == null) { + if (inverseRefutationStatus == null && questionsStatus == null) { if (requestsNumber == agreedNumber) { setProperty(STATUS, PASS); } else if (requestsNumber == deniedNumber) { @@ -286,16 +286,16 @@ } else { setProperty(STATUS, UNKNOWN); } - } else if (inverseRefutationStatus == null && queAndSugStatus != null) { - if (requestsNumber == agreedNumber && queAndSugStatus.equals(PASS)) { + } else if (inverseRefutationStatus == null && questionsStatus != null) { + if (requestsNumber == agreedNumber && questionsStatus.equals(PASS)) { setProperty(STATUS, PASS); } else if (requestsNumber == deniedNumber - && queAndSugStatus.equals(FAILED)) { + && questionsStatus.equals(FAILED)) { setProperty(STATUS, FAILED); } else { setProperty(STATUS, UNKNOWN); } - } else if (inverseRefutationStatus != null & queAndSugStatus == null) { + } else if (inverseRefutationStatus != null & questionsStatus == null) { if (requestsNumber == agreedNumber && inverseRefutationStatus.equals(PASS)) { setProperty(STATUS, PASS); } else if (requestsNumber == deniedNumber @@ -304,9 +304,9 @@ } else { setProperty(STATUS, UNKNOWN); } - }else if (inverseRefutationStatus != null & queAndSugStatus != null) { + }else if (inverseRefutationStatus != null & questionsStatus != null) { String childStatus = UNKNOWN; - if (inverseRefutationStatus.equals(queAndSugStatus)) { + if (inverseRefutationStatus.equals(questionsStatus)) { childStatus = inverseRefutationStatus; } if ( requestsNumber == agreedNumber &&childStatus.equals(PASS) ){ @@ -330,7 +330,7 @@ public void computeAndUpdateStatus() { /* Check child claim */ String inverseRefutationStatus = checkRefutationClaims(); - String queAndSugStatus = checkQuestionAndSuggestionClaims(); + String questionsStatus = checkQuestionClaims(); /* Check user request status */ Object[] requestEdges = getRequestEdges(); String type = getProperty(TYPE).toString(); @@ -340,11 +340,11 @@ Boolean notChanged = false; if (type.equals(UNANIMOUSLY)) { notChanged = checkUnanimously(inverseRefutationStatus, - queAndSugStatus, requestsNumber, agreedNumber, deniedNumber); + questionsStatus, requestsNumber, agreedNumber, deniedNumber); } else if (type.equals(MAJORITY)) { /* !!! !!! */ notChanged = checkUnanimously(inverseRefutationStatus, - queAndSugStatus, requestsNumber, agreedNumber, deniedNumber); + questionsStatus, requestsNumber, agreedNumber, deniedNumber); } else { notChanged = false; } @@ -357,10 +357,9 @@ } parentClaim.computeAndUpdateStatus(); } - - private String checkQuestionAndSuggestionClaims() { - Iterable<Vertex> iter = getVertexIterable(Direction.OUT, L_QUESTION, - L_SUGGESTION); + + private String checkClaims(Direction direction, String... labels) { + Iterable<Vertex> iter = getVertexIterable(direction, labels); if (iter == null) { return null; } @@ -377,6 +376,14 @@ return status; } + private String checkQuestionClaims() { + return checkClaims(Direction.OUT, L_QUESTION); + } + + private String checkQuestionAndSuggestionClaims() { + return checkClaims(Direction.OUT, L_QUESTION, L_SUGGESTION); + } + private String checkRefutationClaims() { Iterable<Vertex> iter = getVertexIterable(Direction.OUT, L_REFUTATION); if (iter == null) {
--- a/logs/application.log Fri Nov 16 07:57:39 2012 +0900 +++ b/logs/application.log Tue Feb 05 15:49:44 2013 +0900 @@ -1,6 +1,12 @@ -2012-11-16 07:56:16,597 - [INFO] - from play in main +2013-02-05 13:31:43,624 - [INFO] - from play in main Listening for HTTP on port 9000... -2012-11-16 07:56:32,196 - [INFO] - from play in play-akka.actor.default-dispatcher-3 +2013-02-05 13:31:50,592 - [INFO] - from play in play-akka.actor.default-dispatcher-2 Application started (Dev) +2013-02-05 15:48:11,876 - [INFO] - from application in play-akka.actor.default-dispatcher-2 +Application shutdown... + +2013-02-05 15:48:11,914 - [INFO] - from play in play-akka.actor.default-dispatcher-2 +Application started (Dev) +