private List<OutPutScreen> getFinalOutPutScreen(List<OutPutScreen> outPutScreens) { boolean isScoreZero = false; for (OutPutScreen outPutScreen : outPutScreens) { System.out.println("Score"); outPutScreen.setScore(outPutScreen.getInternalScore() + outPutScreen.getExternalScore()); if (outPutScreen.getScore() == 0) { isScoreZero = true; } } if (isScoreZero) { return outPutScreens.subList(0, outPutScreens.size() > 5 ? 5 : outPutScreens.size()); } else { List<OutPutScreen> list = new ArrayList<OutPutScreen>(); for (OutPutScreen outPutScreen : outPutScreens) { if (outPutScreen.getInternalScore() == 1 && outPutScreen.getScore() == 1) { list.add(outPutScreen); } if (outPutScreen.getExternalScore() == 1 && outPutScreen.getScore() == 1) { list.add(outPutScreen); } } return list; } }
private int calculateInternalScore(OutPutScreen outPutScreen) { int internalScore = 0; if (outPutScreen.isNoRenforcement() && !outPutScreen.isJtrForSideOne() && !outPutScreen.isJtrForSideTwo()) { return internalScore; } else { if (outPutScreen.isInternalBothSide()) { internalScore = internalScore + 2; } if (outPutScreen.isJtrForSideOne()) { internalScore = internalScore + 2; } if (outPutScreen.isJtrForSideTwo()) { internalScore = internalScore + 2; } if (outPutScreen.isInternalReinforcement()) { internalScore = internalScore + 1; } if (outPutScreen.isIntAndExtEachSide()) { internalScore = internalScore + 1; } if (outPutScreen.isExtAndInternalEachSide()) { internalScore = internalScore + 1; } } return internalScore; }
private List<OutPutScreen> getOnlyExternalReinforcementOptions(List<OutPutScreen> outPutScreens) { List<OutPutScreen> outPutScreenForExternalReinforcementOnly = new ArrayList<OutPutScreen>(); for (OutPutScreen outPutScreen : outPutScreens) { if (outPutScreen.isExternalReinforcement() || outPutScreen.isExternalBothSide()) { outPutScreen.setScore(outPutScreen.getExternalScore()); outPutScreenForExternalReinforcementOnly.add(outPutScreen); } } return outPutScreenForExternalReinforcementOnly; }
private int calculateExternalScore(OutPutScreen outPutScreen) { int externalScore = 0; if (outPutScreen.isNoRenforcement()) { return externalScore; } else { if (outPutScreen.isExternalBothSide()) { externalScore = externalScore + 2; } if (outPutScreen.isExternalReinforcement()) { externalScore = externalScore + 1; } if (outPutScreen.isExtAndInternalEachSide()) { externalScore = externalScore + 1; } if (outPutScreen.isIntAndExtEachSide()) { externalScore = externalScore + 1; } } return externalScore; }
private List<OutPutScreen> getScoringSystemForOutPutScreen(List<OutPutScreen> outPutScreens) { List<OutPutScreen> outPutScreenList = new ArrayList<OutPutScreen>(); for (OutPutScreen outPutScreen : outPutScreens) { outPutScreen.setInternalScore(calculateInternalScore(outPutScreen)); outPutScreen.setExternalScore(calculateExternalScore(outPutScreen)); outPutScreen.setScore(outPutScreen.getInternalScore() + outPutScreen.getExternalScore()); outPutScreen.setPriority(setPriority(outPutScreen)); outPutScreenList.add(outPutScreen); } return outPutScreenList; }
private int setPriority(OutPutScreen outPutScreen) { if (outPutScreen.isNoRenforcement() && !outPutScreen.isJtrForSideOne() && !outPutScreen.isJtrForSideTwo()) { return 0; } else { if (outPutScreen.isInternalBothSide()) { return 3; } if (outPutScreen.isJtrForSideOne()) { return 2; } if (outPutScreen.isJtrForSideTwo()) { return 2; } if (outPutScreen.isInternalReinforcement()) { return 1; } if (outPutScreen.isIntAndExtEachSide()) { return 5; } if (outPutScreen.isExtAndInternalEachSide()) { return 6; } if (outPutScreen.isExternalBothSide()) { return 4; } if (outPutScreen.isExternalReinforcement()) { return 2; } if (outPutScreen.isExtAndInternalEachSide()) { return 6; } if (outPutScreen.isIntAndExtEachSide()) { return 5; } } return 7; }