changeset 46:49aa4ad3008f

modified ClaimModel/checkRefutationClaim method
author one
date Thu, 04 Oct 2012 07:14:11 +0900
parents 0e8b6eda0a0e
children 9645bfb49603
files app/models/ClaimModel.java logs/application.log target/scala-2.9.1/cache/compile/compile
diffstat 3 files changed, 80 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/app/models/ClaimModel.java	Thu Oct 04 06:54:33 2012 +0900
+++ b/app/models/ClaimModel.java	Thu Oct 04 07:14:11 2012 +0900
@@ -268,6 +268,9 @@
 		if (childStatus.equals(UNKNOWN)) {
 			setProperty(STATUS, UNKNOWN);
 			return;
+		} else if (childStatus.equals(FAILED)) {
+			setProperty(STATUS, FAILED);
+			return;
 		}
 		Object[] requestEdges = getRequestEdges();		
 		String type = getProperty(TYPE).toString();
@@ -291,10 +294,10 @@
 		}
 	}
 	
-	private String checkChildClaimStatus(String...labels) {
-		Iterable<Vertex> iter = getVertex(Direction.OUT, labels);			
+	private String checkQuestionAndSuggestionClaims() {
+		Iterable<Vertex> iter = getVertex(Direction.OUT, L_QUESTION, L_SUGGESTION);			
 		if (iter == null) {
-			return null;
+			return PASS;
 		}
 		String status = null;
 		for (Vertex v : iter) {
@@ -309,26 +312,27 @@
 		return status;
 	}
 	
-	private String checkQuestionAndSuggestionClaims() {
-		String childStatus = checkChildClaimStatus(L_QUESTION, L_SUGGESTION);
-		if (childStatus == null) {
+	private String checkRefutationClaims() {
+		Iterable<Vertex> iter = getVertex(Direction.OUT, L_REFUTATION);
+		if (iter == null) {
 			return PASS;
 		}
-		return childStatus;
-	}
-	
-	private String checkRefutationClaims() {
-		String childStatus = checkChildClaimStatus(L_REFUTATION);
-		if (childStatus == null) {
+		String status = null;
+		for (Vertex v : iter) {
+			String childStatus = v.getProperty(STATUS).toString();
+			if (status == null) {
+				status = childStatus;
+			}
+			if (status.equals(PASS)) {
+				return FAILED;
+			} else if (!status.equals(childStatus)) {
+				status = UNKNOWN;
+			}
+		}
+		if (status.equals(FAILED)) {
 			return PASS;
 		}
-		if (childStatus.equals(PASS) ) {
-			return  FAILED;
-		} else if (childStatus.equals(FAILED)){
-			return PASS;
-		} else {
-			return UNKNOWN;
-		}
+		return UNKNOWN; 
 	}
 	
 	private String checkAllChildsStatus() {
@@ -336,11 +340,8 @@
 		String refutationStatus = checkRefutationClaims();
 		if (refutationStatus.equals(FAILED)) {
 			return FAILED;
-		}
-		if (queAndSugStatus.equals(refutationStatus)) {
+		} else if (refutationStatus.equals(queAndSugStatus)) {
 			return queAndSugStatus;
-		} else if (refutationStatus.equals(FAILED)) {
-			return FAILED;
 		} else {
 			return UNKNOWN;
 		}
--- a/logs/application.log	Thu Oct 04 06:54:33 2012 +0900
+++ b/logs/application.log	Thu Oct 04 07:14:11 2012 +0900
@@ -1,6 +1,60 @@
-2012-10-04 06:26:16,551 - [INFO] - from play in main 
+2012-10-04 07:08:10,021 - [INFO] - from play in main 
 Listening for HTTP on port 9000...
 
-2012-10-04 06:26:20,312 - [INFO] - from play in play-akka.actor.default-dispatcher-2 
+2012-10-04 07:08:14,432 - [INFO] - from play in play-akka.actor.default-dispatcher-1 
+Application started (Dev)
+
+2012-10-04 07:08:45,581 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
+Application shutdown...
+
+2012-10-04 07:08:45,598 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
+Application started (Dev)
+
+2012-10-04 07:09:15,488 - [INFO] - from application in play-akka.actor.default-dispatcher-1 
+Application shutdown...
+
+2012-10-04 07:09:15,502 - [INFO] - from play in play-akka.actor.default-dispatcher-1 
+Application started (Dev)
+
+2012-10-04 07:10:39,081 - [INFO] - from application in play-akka.actor.default-dispatcher-3 
+Application shutdown...
+
+2012-10-04 07:10:39,095 - [INFO] - from play in play-akka.actor.default-dispatcher-3 
+Application started (Dev)
+
+2012-10-04 07:10:54,461 - [INFO] - from application in play-akka.actor.default-dispatcher-4 
+Application shutdown...
+
+2012-10-04 07:10:54,475 - [INFO] - from play in play-akka.actor.default-dispatcher-4 
 Application started (Dev)
 
+2012-10-04 07:11:09,458 - [INFO] - from application in play-akka.actor.default-dispatcher-5 
+Application shutdown...
+
+2012-10-04 07:11:09,471 - [INFO] - from play in play-akka.actor.default-dispatcher-5 
+Application started (Dev)
+
+2012-10-04 07:13:02,473 - [INFO] - from application in play-akka.actor.default-dispatcher-4 
+Application shutdown...
+
+2012-10-04 07:13:02,486 - [INFO] - from play in play-akka.actor.default-dispatcher-4 
+Application started (Dev)
+
+2012-10-04 07:13:23,693 - [INFO] - from application in play-akka.actor.default-dispatcher-5 
+Application shutdown...
+
+2012-10-04 07:13:23,708 - [INFO] - from play in play-akka.actor.default-dispatcher-5 
+Application started (Dev)
+
+2012-10-04 07:13:43,674 - [INFO] - from application in play-akka.actor.default-dispatcher-4 
+Application shutdown...
+
+2012-10-04 07:13:43,687 - [INFO] - from play in play-akka.actor.default-dispatcher-4 
+Application started (Dev)
+
+2012-10-04 07:13:48,673 - [INFO] - from application in play-akka.actor.default-dispatcher-5 
+Application shutdown...
+
+2012-10-04 07:13:48,685 - [INFO] - from play in play-akka.actor.default-dispatcher-5 
+Application started (Dev)
+
Binary file target/scala-2.9.1/cache/compile/compile has changed