/** * Creates a new {@code DefaultWeightedInputOutputPair} that is a shallow * copy of the given {@code WeightedInputOuptutPair}. * * @param other * The other weighted input-output pair to copy the values of. */ public DefaultWeightedInputOutputPair( final WeightedInputOutputPair<? extends InputType, ? extends OutputType> other) { this(other.getInput(), other.getOutput(), other.getWeight()); }
/** * Gets the weight of a given input-output pair. If it is a weighted * input-output pair (implements the {@code WeightedInputOutputPair} * 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 InputOutputPair<?, ?> pair) { if (pair instanceof WeightedInputOutputPair<?, ?>) { return ((WeightedInputOutputPair<?, ?>) pair).getWeight(); } else { return 1.0; } }
/** * Gets the weight of a given input-output pair. If it is a weighted * input-output pair (implements the {@code WeightedInputOutputPair} * 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 InputOutputPair<?, ?> pair) { if (pair instanceof WeightedInputOutputPair<?, ?>) { return ((WeightedInputOutputPair<?, ?>) pair).getWeight(); } else { return 1.0; } }
/** * Creates a new {@code DefaultWeightedInputOutputPair} that is a shallow * copy of the given {@code WeightedInputOuptutPair}. * * @param other * The other weighted input-output pair to copy the values of. */ public DefaultWeightedInputOutputPair( final WeightedInputOutputPair<? extends InputType, ? extends OutputType> other) { this(other.getInput(), other.getOutput(), other.getWeight()); }
/** * Gets the weight of a given input-output pair. If it is a weighted * input-output pair (implements the {@code WeightedInputOutputPair} * 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 InputOutputPair<?, ?> pair) { if (pair instanceof WeightedInputOutputPair<?, ?>) { return ((WeightedInputOutputPair<?, ?>) pair).getWeight(); } else { return 1.0; } }
/** * Creates a new {@code DefaultWeightedInputOutputPair} that is a shallow * copy of the given {@code WeightedInputOuptutPair}. * * @param other * The other weighted input-output pair to copy the values of. */ public DefaultWeightedInputOutputPair( final WeightedInputOutputPair<? extends InputType, ? extends OutputType> other) { this(other.getInput(), other.getOutput(), other.getWeight()); }
/** * {@inheritDoc} * @param data {@inheritDoc} * @param cogxels {@inheritDoc} */ public void toCogxels( WeightedInputOutputPair<InputType, OutputType> data, CogxelState cogxels) { this.getPairConverter().toCogxels( data, cogxels ); this.getWeightConverter().toCogxels( data.getWeight(), cogxels ); }
/** * {@inheritDoc} * @param data {@inheritDoc} * @param cogxels {@inheritDoc} */ public void toCogxels( WeightedInputOutputPair<InputType, OutputType> data, CogxelState cogxels) { this.getPairConverter().toCogxels( data, cogxels ); this.getWeightConverter().toCogxels( data.getWeight(), cogxels ); }
if (pair instanceof WeightedInputOutputPair<?, ?>) double weight = ((WeightedInputOutputPair<?, ?>) pair).getWeight(); rowPair = new DefaultWeightedInputOutputPair<Double, Double>( x, y, weight);
if (pair instanceof WeightedInputOutputPair<?, ?>) double weight = ((WeightedInputOutputPair<?, ?>) pair).getWeight(); rowPair = new DefaultWeightedInputOutputPair<Double, Double>( x, y, weight);
if (pair instanceof WeightedInputOutputPair<?, ?>) double weight = ((WeightedInputOutputPair<?, ?>) pair).getWeight(); rowPair = new DefaultWeightedInputOutputPair<Double, Double>( x, y, weight);