Code Duplication    Length = 17-18 lines in 3 locations

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

@@ 939-956 (lines=18) @@
936
		// set execution flag
937
		boolean canStart = dependencies.isEmpty();
938
		// check execution flag
939
		if (!canStart) {
940
			
941
			// check if conditions are satisfied
942
			Iterator<ExecutionNode> it = dependencies.keySet().iterator();
943
			// check all conditions
944
			while (it.hasNext() && !canStart) {
945
				
946
				// get a dependency parent
947
				ExecutionNode d = it.next();
948
				// get start conditions
949
				ExecutionNodeStatus[] conditions = dependencies.get(d);
950
				// check if one of the disjunctive conditions is satisfied
951
				for (ExecutionNodeStatus condition : conditions) {
952
					// check condition
953
					if (d.getStatus().equals(condition)) {
954
						// node can start
955
						canStart = true;
956
						break;
957
					}
958
				}
959
			}
@@ 900-916 (lines=17) @@
897
		// set end execution flag 
898
		boolean canStop = dependencies.isEmpty();
899
		// check execution flag
900
		if (!canStop) {
901
			
902
			// check if conditions are satisfied
903
			Iterator<ExecutionNode> it = dependencies.keySet().iterator();
904
			// check all conditions
905
			while (it.hasNext() && !canStop) {
906
				
907
				// get next dependency
908
				ExecutionNode d = it.next();
909
				// get end conditions
910
				ExecutionNodeStatus[] conditions = dependencies.get(d);
911
				// check if one of the disjunctive conditions is satisfied
912
				for (ExecutionNodeStatus condition : conditions) {
913
					// check condition
914
					if (d.getStatus().equals(condition)) {
915
						canStop = true;
916
						break;
917
					}
918
					
919
				}
@@ 862-878 (lines=17) @@
859
		// set end execution flag 
860
		boolean canEnd = dependencies.isEmpty();
861
		// check execution flag
862
		if (!canEnd) {
863
			
864
			// check if conditions are satisfied
865
			Iterator<ExecutionNode> it = dependencies.keySet().iterator();
866
			// check all conditions
867
			while (it.hasNext() && !canEnd) {
868
				
869
				// get next dependency
870
				ExecutionNode d = it.next();
871
				// get end conditions
872
				ExecutionNodeStatus[] conditions = dependencies.get(d);
873
				// check if one of the disjunctive conditions is satisfied
874
				for (ExecutionNodeStatus condition : conditions) {
875
					// check condition
876
					if (d.getStatus().equals(condition)) {
877
						canEnd = true;
878
						break;
879
					}
880
					
881
				}