IndexTranslator.java 688 B

123456789101112131415161718192021
  1. package holeg.ui.controller;
  2. import holeg.interfaces.LocalMode;
  3. public class IndexTranslator {
  4. /**
  5. * Determines the index of the internal value array of an element that should be used, since
  6. * elements only save 100 values, but iterations and local period can be anything between 1 and
  7. * 100000.
  8. *
  9. * @param e the element for which the calculation should be made.
  10. * @param timeStep the iteration for which the calculation should be made.
  11. * @return effective Index
  12. */
  13. public static int getEffectiveIndex(LocalMode e, int timeStep) {
  14. int period = e.getPeriod().getInterval();
  15. return timeStep % period * 100 / period;
  16. }
  17. }