Exemplo n.º 1
0
        /**
         * <code>comparePossibleTargets</code> is used in <code>rateFactor</code> to compare two <code>PossibleTargets</code>'s factor values.
         * @param factor	the factor of which the value has to be compared
         * @param possible	the first PossibleSpot (the one that will be placed before the evaluation symbol)
         * @param best		the second PossibleSpot (the one that will be placed behind the evaluation symbol)
         * @return result	an Boolean[2] array. Index 0 will contain true/false for the >/< evaluator and Index 1 will contain the true/false for the == evaluator.
         */
        private Boolean[] comparePossibleTargets(Factor factor, PossibleTarget possible, PossibleTarget best)
        {
            // Create a new Boolean[] that will contain the results of comparePossibleTargets
            Boolean[] result = new Boolean[2];
            //System.out.println("Spots: " + possible.toGoalSpot().toString() + ", " + best.toGoalSpot().toString());

            // Look at which factor has to be compared and compare them between two PossibleTargets
            if (factor == Factor.TPD)
            {
                result [0] = (possible.getTPD() > best.getTPD());
                result [1] = possible.getTPD() == best.getTPD();
                //System.out.println("result 0: " + result[0]);
                //System.out.println("result 1: " + result[1]);
            }
            else if (factor == Factor.ST)
            {
                result [0] = possible.getSurThreat() < best.getSurThreat();
                result [1] = possible.getSurThreat() == best.getSurThreat();
            }
            else if (factor == Factor.SD)
            {
                result [0] = possible.getSD() < best.getSD();
                result [1] = possible.getSD() == best.getSD();
            }
            else if (factor == Factor.FDC)
            {
                result [0] = possible.getCalcCost() < best.getCalcCost();
                result [1] = possible.getCalcCost() == best.getCalcCost();
            }
            else if (factor == Factor.HD)
            {
                result[0] = possible.getHighestDanger() < best.getHighestDanger();
                result[1] = possible.getHighestDanger() == best.getHighestDanger();
            }
            return(result);
        }