Mercurial > hg > Members > nobuyasu > Consensus
comparison app/models/ClaimModel.java @ 49:36ddbd5e5d45
modified computeAndUpdateStatus
author | one |
---|---|
date | Thu, 04 Oct 2012 14:00:08 +0900 |
parents | bc35c27966f5 |
children | d6c623e92837 |
comparison
equal
deleted
inserted
replaced
48:bc35c27966f5 | 49:36ddbd5e5d45 |
---|---|
278 if ( inverseRefutationStatus == null && queAndSugStatus == null) { | 278 if ( inverseRefutationStatus == null && queAndSugStatus == null) { |
279 if (requestsNumber == agreedNumber) { | 279 if (requestsNumber == agreedNumber) { |
280 setProperty(STATUS, PASS); | 280 setProperty(STATUS, PASS); |
281 } else if (requestsNumber == deniedNumber) { | 281 } else if (requestsNumber == deniedNumber) { |
282 setProperty(STATUS, FAILED); | 282 setProperty(STATUS, FAILED); |
283 } | 283 } else { |
284 setProperty(STATUS, UNKNOWN); | |
285 } | |
284 } else if (inverseRefutationStatus != null && queAndSugStatus == null) { | 286 } else if (inverseRefutationStatus != null && queAndSugStatus == null) { |
285 setProperty(STATUS, inverseRefutationStatus); | 287 setProperty(STATUS, inverseRefutationStatus); |
286 } else if (inverseRefutationStatus == null && queAndSugStatus != null) { | 288 } else if (inverseRefutationStatus == null && queAndSugStatus != null) { |
287 if (requestsNumber == agreedNumber && queAndSugStatus.equals(PASS)) { | 289 if (requestsNumber == agreedNumber && queAndSugStatus.equals(PASS)) { |
288 setProperty(STATUS, PASS); | 290 setProperty(STATUS, PASS); |
305 | 307 |
306 public void computeAndUpdateStatus() { | 308 public void computeAndUpdateStatus() { |
307 /* Check child claim */ | 309 /* Check child claim */ |
308 String inverseRefutationStatus = checkRefutationClaims(); | 310 String inverseRefutationStatus = checkRefutationClaims(); |
309 String queAndSugStatus = checkQuestionAndSuggestionClaims(); | 311 String queAndSugStatus = checkQuestionAndSuggestionClaims(); |
310 System.out.println("inverseRefutationStatus = "+inverseRefutationStatus); | |
311 System.out.println("queAndSugStatus = "+queAndSugStatus); | |
312 /* Check user request status */ | 312 /* Check user request status */ |
313 Object[] requestEdges = getRequestEdges(); | 313 Object[] requestEdges = getRequestEdges(); |
314 String type = getProperty(TYPE).toString(); | 314 String type = getProperty(TYPE).toString(); |
315 long requestsNumber = requestEdges.length; | 315 long requestsNumber = requestEdges.length; |
316 long agreedNumber = getAgreedNumber(requestEdges); | 316 long agreedNumber = getAgreedNumber(requestEdges); |
317 long deniedNumber = getDeninedNumber(requestEdges); | 317 long deniedNumber = getDeninedNumber(requestEdges); |
318 Boolean notChanged = false; | 318 Boolean notChanged = false; |
319 if (type.equals(UNANIMOUSLY)) { | 319 if (type.equals(UNANIMOUSLY)) { |
320 System.out.println("UNAMIMOUSLY'"); | |
321 notChanged = checkUnanimously(inverseRefutationStatus, queAndSugStatus, requestsNumber, agreedNumber, deniedNumber); | 320 notChanged = checkUnanimously(inverseRefutationStatus, queAndSugStatus, requestsNumber, agreedNumber, deniedNumber); |
322 } else if (type.equals(MAJORITY)) { | 321 } else if (type.equals(MAJORITY)) { |
323 | 322 |
324 } else { | 323 } else { |
325 notChanged = false; | 324 notChanged = false; |
353 } | 352 } |
354 | 353 |
355 private String checkRefutationClaims() { | 354 private String checkRefutationClaims() { |
356 Iterable<Vertex> iter = getVertexIterable(Direction.OUT, L_REFUTATION); | 355 Iterable<Vertex> iter = getVertexIterable(Direction.OUT, L_REFUTATION); |
357 if (iter == null) { | 356 if (iter == null) { |
358 System.out.println("Refutation iterable is null"); | |
359 return null; | 357 return null; |
360 } | 358 } |
361 String status = null; | 359 String status = null; |
362 for (Vertex v : iter) { | 360 for (Vertex v : iter) { |
363 String childStatus = v.getProperty(STATUS).toString(); | 361 String childStatus = v.getProperty(STATUS).toString(); |