/** * Gets the weight of a given target-estimate pair. If it is a weighted * target-estimate pair (implements the {@code WeightedTargetEstimatePair} * interface, then it casts it to retrieve its weight. Otherwise, it * returns 1.0. * * @param pair * The pair to get the weight of. * @return * The weight of the given pair, if it exists, otherwise 1.0. */ public static double getWeight( final TargetEstimatePair<?, ?> pair) { if (pair instanceof WeightedTargetEstimatePair<?, ?>) { return ((WeightedTargetEstimatePair<?, ?>) pair).getWeight(); } else { return 1.0; } }
/** * Gets the weight of a given target-estimate pair. If it is a weighted * target-estimate pair (implements the {@code WeightedTargetEstimatePair} * interface, then it casts it to retrieve its weight. Otherwise, it * returns 1.0. * * @param pair * The pair to get the weight of. * @return * The weight of the given pair, if it exists, otherwise 1.0. */ public static double getWeight( final TargetEstimatePair<?, ?> pair) { if (pair instanceof WeightedTargetEstimatePair<?, ?>) { return ((WeightedTargetEstimatePair<?, ?>) pair).getWeight(); } else { return 1.0; } }
/** * Gets the weight of a given target-estimate pair. If it is a weighted * target-estimate pair (implements the {@code WeightedTargetEstimatePair} * interface, then it casts it to retrieve its weight. Otherwise, it * returns 1.0. * * @param pair * The pair to get the weight of. * @return * The weight of the given pair, if it exists, otherwise 1.0. */ public static double getWeight( final TargetEstimatePair<?, ?> pair) { if (pair instanceof WeightedTargetEstimatePair<?, ?>) { return ((WeightedTargetEstimatePair<?, ?>) pair).getWeight(); } else { return 1.0; } }