// Path: src/main/java/com/botthoughts/wheelencodergenerator/EncoderTrack.java
// public class EncoderTrack {
//     public double outerDiameter;
//     public double innerDiameter;
//     public double startAngle;
//     public double stripeAngle;
//     public int stripeCount;
// 
//     /**
//      * 
//      * @param outerDiameter outer diameter (all units managed externally)
//      * @param innerDiameter inner diameter
//      * @param startAngle starting angle for first stripe in degrees
//      * @param stripeSweepAngle angle of each white and black stripe
//      * @param stripeCount number of black stripes
//      */
//     public EncoderTrack(double outerDiameter, double innerDiameter, double startAngle, 
//             double stripeSweepAngle, int stripeCount) {
//         this.outerDiameter = outerDiameter;
//         this.innerDiameter = innerDiameter;
//         this.startAngle = startAngle;
//         this.stripeAngle = stripeSweepAngle;
//         this.stripeCount = stripeCount;
//     }
// 
// }


import com.botthoughts.wheelencodergenerator.EncoderTrack;
import java.util.List;
import java.util.function.UnaryOperator;
/*
 * Copyright 2021 mes.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.botthoughts.wheelencodergenerator.model;


/**
 * Functionality required of--and unique to--each encoder type.
 * @author mes
 */
public interface EncoderModel {

  /**
   * Return minimum resolution for the encoder.
   *
   * @return min resolution
   */
  abstract public int getMinResolution();

  /**
   * Return maximum resolution for the encoder.
   *
   * @return max resolution
   */
  abstract public int getMaxResolution();

  /**
   * Return the UnaryOperator for incrementing resolution
   *
   * @return resolution increment value
   */
  abstract public UnaryOperator<Integer> getResolutionIncrement();
  
  /**
   * Return the UnaryOperator for decrementing resolution
   *
   * @return resolution increment value
   */
  abstract public UnaryOperator<Integer> getResolutionDecrement();
  
  /**
   * Return list of ordered Track objects for this encoder.Track information is computed on-demand.
   *
   * @param id Inside diameter
   * @param od Outside diameter
   * @param resolution Resolution of encoder
   * @param index include index track
   * @param clockwise true if encoder is designed to rotate clockwise
   * @return list of tracks
   */
  abstract public List<EncoderTrack> getTracks(double id, double od, int resolution, boolean index,
      boolean clockwise);

  /**
   * Determine if provided resolution is valid for encoder type
   *
   * @param resolution
   * @return true if resolution is valid, false otherwise
   */
  abstract public boolean validResolution(int resolution);

  /**
   * If resolution is not valid, set it to the nearest valid value.
   * @param resolution is the encoder resolution
   * @return resolution, if valid, or the nearest valid value
   */
// Path: src/main/java/com/botthoughts/wheelencodergenerator/EncoderTrack.java
// public class EncoderTrack {
//     public double outerDiameter;
//     public double innerDiameter;
//     public double startAngle;
//     public double stripeAngle;
//     public int stripeCount;
// 
//     /**
//      * 
//      * @param outerDiameter outer diameter (all units managed externally)
//      * @param innerDiameter inner diameter
//      * @param startAngle starting angle for first stripe in degrees
//      * @param stripeSweepAngle angle of each white and black stripe
//      * @param stripeCount number of black stripes
//      */
//     public EncoderTrack(double outerDiameter, double innerDiameter, double startAngle, 
//             double stripeSweepAngle, int stripeCount) {
//         this.outerDiameter = outerDiameter;
//         this.innerDiameter = innerDiameter;
//         this.startAngle = startAngle;
//         this.stripeAngle = stripeSweepAngle;
//         this.stripeCount = stripeCount;
//     }
// 
// }


// Path: src/main/java/com/botthoughts/wheelencodergenerator/model/EncoderModel.java
import com.botthoughts.wheelencodergenerator.EncoderTrack;
import java.util.List;
import java.util.function.UnaryOperator;

/*
 * Copyright 2021 mes.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.botthoughts.wheelencodergenerator.model;


/**
 * Functionality required of--and unique to--each encoder type.
 * @author mes
 */
public interface EncoderModel {

  /**
   * Return minimum resolution for the encoder.
   *
   * @return min resolution
   */
  abstract public int getMinResolution();

  /**
   * Return maximum resolution for the encoder.
   *
   * @return max resolution
   */
  abstract public int getMaxResolution();

  /**
   * Return the UnaryOperator for incrementing resolution
   *
   * @return resolution increment value
   */
  abstract public UnaryOperator<Integer> getResolutionIncrement();
  
  /**
   * Return the UnaryOperator for decrementing resolution
   *
   * @return resolution increment value
   */
  abstract public UnaryOperator<Integer> getResolutionDecrement();
  
  /**
   * Return list of ordered Track objects for this encoder.Track information is computed on-demand.
   *
   * @param id Inside diameter
   * @param od Outside diameter
   * @param resolution Resolution of encoder
   * @param index include index track
   * @param clockwise true if encoder is designed to rotate clockwise
   * @return list of tracks
   */
  abstract public List<EncoderTrack> getTracks(double id, double od, int resolution, boolean index,
      boolean clockwise);

  /**
   * Determine if provided resolution is valid for encoder type
   *
   * @param resolution
   * @return true if resolution is valid, false otherwise
   */
  abstract public boolean validResolution(int resolution);

  /**
   * If resolution is not valid, set it to the nearest valid value.
   * @param resolution is the encoder resolution
   * @return resolution, if valid, or the nearest valid value
   */
  abstract public int fixResolution(int resolution);