// Path: public-java/iamcontent-core/src/main/java/com/iamcontent/core/lang/Delegator.java
// public abstract class Delegator<D> {
// 	private final D delegate;
// 
// 	public Delegator(D delegate) {
// 		requireNonNull(delegate, "Delegate cannot be null.");
// 		this.delegate = delegate;
// 	}
// 
// 	protected D delegate() {
// 		return delegate;
// 	} 
// }
// 
// Path: public-java/io/iamcontent-servos/src/main/java/com/iamcontent/device/servo/Servo.java
// public interface Servo extends AnalogIO, ServoFeatures<MutableDouble> {
// 
// 	/**
// 	 * Returns a proxy {@link Servo} that is two-way calibrated representation of this instance.
// 	 */
// 	default Servo calibrated(ServoCalibration calibration) {
// 		return new CalibratedServo(this, calibration);
// 	}
// }
// 
// Path: public-java/io/iamcontent-servos/src/main/java/com/iamcontent/device/servo/ServoSource.java
// public interface ServoSource<C> extends PerChannelSource<C, Servo> {
// 
// 	/**
// 	 * Returns a ServoSource that has new channel ids, as defined by the given function.
// 	 */
// 	default <NewServoId> ServoSource<NewServoId> remapped(Function<NewServoId, C> remapping) {
// 		return new RemappedServoSource<NewServoId, C>(this, remapping);
// 	}
// 
// 	/**
// 	 * Returns a ServoSource that returns calibrated proxies of the {@link Servo}s from another (target) {@link ServoSource}.
// 	 */
// 	default ServoSource<C> calibrated(ServoSourceCalibration<C> calibration) {
// 		return new CalibratedServoSource<C>(this, calibration);
// 	}
// 
// 	/**
// 	 * Returns a ServoSource that returns calibrated proxies of the {@link Servo}s from another (target) {@link ServoSource}.
// 	 */
// 	default ServoSource<C> calibrated(ServoCalibration calibration) {
// 		return calibrated(servoSourceCalibration(calibration));
// 	}
// 
// 	/**
// 	 * @return A {@link ServoSource} of {@link RawServo}s for the given {@link ServoController}.
// 	 */
// 	public static <C> ServoSource<C> rawServoSource(final ServoController<C> controller) {
// 		return new ServoSource<C>() {
// 			@Override
// 			public Servo forChannel(C channel) {
// 				return new RawServo<C>(controller, channel);
// 			}
// 		};
// 	}
// 
// }
// 
// Path: public-java/io/iamcontent-servos/src/main/java/com/iamcontent/device/servo/ServoSourceCalibration.java
// public interface ServoSourceCalibration<C> extends PerChannelSource<C, ServoCalibration> {
// 
// 
// 	public static <C> DefaultingServoSourceCalibration<C> servoSourceCalibration(ServoCalibration calibration) {
// 		return new DefaultingServoSourceCalibration<C>(calibration);
// 	}
// 
// 	public static <C> DefaultingServoSourceCalibration<C> servoSourceCalibration() {
// 		return servoSourceCalibration(ServoCalibration.IDENTITY);
// 	}
// }


import com.iamcontent.core.lang.Delegator;
import com.iamcontent.device.servo.Servo;
import com.iamcontent.device.servo.ServoSource;
import com.iamcontent.device.servo.ServoSourceCalibration;

/**
  IAmContent Public Libraries.
  Copyright (C) 2015-2021 Greg Elderfield
  @author Greg Elderfield, support@jarchitect.co.uk
 
  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU General Public License as published by the Free Software Foundation; either version 2 of 
  the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along with this program;
  if not, write to the Free Software Foundation, Inc., 
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.iamcontent.device.servo.impl;


/**
 * A ServoSource that returns calibrated proxies of the {@link Servo}s from another (target) {@link ServoSource}.
 * All {@link Servo}s are calibrated using the same {@link ServoSourceCalibration}
 * 
 * @author Greg Elderfield
 */
public class CalibratedServoSource<C> extends Delegator<ServoSource<C>> implements ServoSource<C> {
	
	protected final ServoSourceCalibration<C> calibration;
	

// Path: public-java/iamcontent-core/src/main/java/com/iamcontent/core/lang/Delegator.java
// public abstract class Delegator<D> {
// 	private final D delegate;
// 
// 	public Delegator(D delegate) {
// 		requireNonNull(delegate, "Delegate cannot be null.");
// 		this.delegate = delegate;
// 	}
// 
// 	protected D delegate() {
// 		return delegate;
// 	} 
// }
// 
// Path: public-java/io/iamcontent-servos/src/main/java/com/iamcontent/device/servo/Servo.java
// public interface Servo extends AnalogIO, ServoFeatures<MutableDouble> {
// 
// 	/**
// 	 * Returns a proxy {@link Servo} that is two-way calibrated representation of this instance.
// 	 */
// 	default Servo calibrated(ServoCalibration calibration) {
// 		return new CalibratedServo(this, calibration);
// 	}
// }
// 
// Path: public-java/io/iamcontent-servos/src/main/java/com/iamcontent/device/servo/ServoSource.java
// public interface ServoSource<C> extends PerChannelSource<C, Servo> {
// 
// 	/**
// 	 * Returns a ServoSource that has new channel ids, as defined by the given function.
// 	 */
// 	default <NewServoId> ServoSource<NewServoId> remapped(Function<NewServoId, C> remapping) {
// 		return new RemappedServoSource<NewServoId, C>(this, remapping);
// 	}
// 
// 	/**
// 	 * Returns a ServoSource that returns calibrated proxies of the {@link Servo}s from another (target) {@link ServoSource}.
// 	 */
// 	default ServoSource<C> calibrated(ServoSourceCalibration<C> calibration) {
// 		return new CalibratedServoSource<C>(this, calibration);
// 	}
// 
// 	/**
// 	 * Returns a ServoSource that returns calibrated proxies of the {@link Servo}s from another (target) {@link ServoSource}.
// 	 */
// 	default ServoSource<C> calibrated(ServoCalibration calibration) {
// 		return calibrated(servoSourceCalibration(calibration));
// 	}
// 
// 	/**
// 	 * @return A {@link ServoSource} of {@link RawServo}s for the given {@link ServoController}.
// 	 */
// 	public static <C> ServoSource<C> rawServoSource(final ServoController<C> controller) {
// 		return new ServoSource<C>() {
// 			@Override
// 			public Servo forChannel(C channel) {
// 				return new RawServo<C>(controller, channel);
// 			}
// 		};
// 	}
// 
// }
// 
// Path: public-java/io/iamcontent-servos/src/main/java/com/iamcontent/device/servo/ServoSourceCalibration.java
// public interface ServoSourceCalibration<C> extends PerChannelSource<C, ServoCalibration> {
// 
// 
// 	public static <C> DefaultingServoSourceCalibration<C> servoSourceCalibration(ServoCalibration calibration) {
// 		return new DefaultingServoSourceCalibration<C>(calibration);
// 	}
// 
// 	public static <C> DefaultingServoSourceCalibration<C> servoSourceCalibration() {
// 		return servoSourceCalibration(ServoCalibration.IDENTITY);
// 	}
// }


// Path: public-java/io/iamcontent-servos/src/main/java/com/iamcontent/device/servo/impl/CalibratedServoSource.java
import com.iamcontent.core.lang.Delegator;
import com.iamcontent.device.servo.Servo;
import com.iamcontent.device.servo.ServoSource;
import com.iamcontent.device.servo.ServoSourceCalibration;

/**
  IAmContent Public Libraries.
  Copyright (C) 2015-2021 Greg Elderfield
  @author Greg Elderfield, support@jarchitect.co.uk
 
  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU General Public License as published by the Free Software Foundation; either version 2 of 
  the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along with this program;
  if not, write to the Free Software Foundation, Inc., 
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.iamcontent.device.servo.impl;


/**
 * A ServoSource that returns calibrated proxies of the {@link Servo}s from another (target) {@link ServoSource}.
 * All {@link Servo}s are calibrated using the same {@link ServoSourceCalibration}
 * 
 * @author Greg Elderfield
 */
public class CalibratedServoSource<C> extends Delegator<ServoSource<C>> implements ServoSource<C> {
	
	protected final ServoSourceCalibration<C> calibration;
	

	public CalibratedServoSource(ServoSource<C> target, ServoSourceCalibration<C> calibration) {
