Code Duplication    Length = 26-26 lines in 3 locations

src/main/java/it/cnr/istc/pst/platinum/ai/executive/pdb/ExecutivePlanDataBase.java 3 locations

@@ 952-977 (lines=26) @@
949
		// get node's start dependencies
950
		Map<ExecutionNode, ExecutionNodeStatus[]> dependencies = this.getNodeStartDependencies(node);
951
		// check execution flag
952
		if (!dependencies.isEmpty()) {
953
			
954
			// check if conditions are satisfied
955
			Iterator<ExecutionNode> it = dependencies.keySet().iterator();
956
			// check all conditions
957
			while (it.hasNext() && canStart) {
958
				
959
				// get a dependency parent
960
				ExecutionNode d = it.next();
961
				// get start conditions
962
				ExecutionNodeStatus[] conditions = dependencies.get(d);
963
				// check if at least one is satisfied
964
				boolean satisfied = false;
965
				
966
				// check if one of the disjunctive conditions is satisfied
967
				for (ExecutionNodeStatus condition : conditions) {
968
					// check condition
969
					if (d.getStatus().equals(condition)) {
970
						// node can start
971
						satisfied = true;
972
						break;
973
					}
974
				}
975
				
976
				// update can start flag
977
				canStart = satisfied;
978
			}
979
		}
980
		
@@ 907-932 (lines=26) @@
904
		// check dependencies if any
905
		Map<ExecutionNode, ExecutionNodeStatus[]> dependencies = this.getNodeStopDependencies(node);
906
		// check execution flag
907
		if (!dependencies.isEmpty()) {
908
			
909
			// check if conditions are satisfied
910
			Iterator<ExecutionNode> it = dependencies.keySet().iterator();
911
			// check all conditions
912
			while (it.hasNext() && canStop) {
913
				
914
				// get next dependency
915
				ExecutionNode d = it.next();
916
				// get end conditions
917
				ExecutionNodeStatus[] conditions = dependencies.get(d);
918
				// check if at least one is satisfied
919
				boolean satisfied = false;
920
				
921
				// check if one of the disjunctive conditions is satisfied
922
				for (ExecutionNodeStatus condition : conditions) {
923
					// check condition
924
					if (d.getStatus().equals(condition)) {
925
						satisfied = true;
926
						break;
927
					}
928
					
929
				}
930
				
931
				// update can end flag
932
				canStop = satisfied;
933
			}
934
		}
935
		
@@ 862-887 (lines=26) @@
859
		boolean canEnd = true;
860
		// check dependencies if any
861
		Map<ExecutionNode, ExecutionNodeStatus[]> dependencies = this.getNodeEndDependencies(node);
862
		if (!dependencies.isEmpty()) {
863
			
864
			// check if conditions are satisfied
865
			Iterator<ExecutionNode> it = dependencies.keySet().iterator();
866
			// at least one condition for each dependency should be satisfied
867
			while (it.hasNext() && canEnd) {
868
				
869
				// get next dependency
870
				ExecutionNode d = it.next();
871
				// get end conditions for the current node
872
				ExecutionNodeStatus[] conditions = dependencies.get(d);
873
				
874
				// check if at least one is satisfied
875
				boolean satisfied = false;
876
				// check if one of the disjunctive conditions is satisfied
877
				for (ExecutionNodeStatus condition : conditions) {
878
					// check condition
879
					if (d.getStatus().equals(condition)) {
880
						satisfied = true;
881
						break;
882
					}
883
					
884
				}
885
				
886
				// update can end flag
887
				canEnd = satisfied;
888
			}
889
		}
890