X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.history%2Fsrc%2Forg%2Fsimantics%2Fhistory%2Fcsv%2FExportInterpolation.java;h=5295ee08feea746a2c9678a334575794a11a2ad3;hb=b885083762a43ec97162a5f77df4fd5f85e28979;hp=b0cad53b5e4b444d4c7fd24ea2b282deda9e800a;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.history/src/org/simantics/history/csv/ExportInterpolation.java b/bundles/org.simantics.history/src/org/simantics/history/csv/ExportInterpolation.java index b0cad53b5..5295ee08f 100644 --- a/bundles/org.simantics.history/src/org/simantics/history/csv/ExportInterpolation.java +++ b/bundles/org.simantics.history/src/org/simantics/history/csv/ExportInterpolation.java @@ -1,70 +1,70 @@ -package org.simantics.history.csv; - -import java.util.ArrayList; -import java.util.List; - -/** - * Specifies the interpolation method to use when producing exported samples in - * {@link CSVFormatter}. - * - * @author Tuukka Lehtonen - * @see CSVFormatter - */ -public enum ExportInterpolation { - - /** - * Directly take the last sample whose time stamp is less than or equal to - * the sampling time. - */ - PREVIOUS_SAMPLE("Previous sample", "previous"), - - /** - *
-	 * v1               vs                   v2
-	 * |----------------|--------------------|
-	 * t1               ts                   t2
-	 * 
- * - * Here t1 and t2 are time stamps of those two - * successive samples for which t1 ≤ ts ≤ - * t2. - * - *

- * The sampling result is then: - * vs = v1+(v2-v1)*(ts-t1)/(t2-t1). - */ - LINEAR_INTERPOLATION("Linear interpolation", "lerp"); - - public String label; - public String preference; - ExportInterpolation(String label, String preference) { - this.label = label; - this.preference = preference; - } - public static List list() { - return toList(LINEAR_INTERPOLATION, PREVIOUS_SAMPLE); - } - public static ExportInterpolation fromIndex(int index) { - return list().get(index); - } - public static ExportInterpolation fromPreference(String preference) { - for(ExportInterpolation s : list()) { - if(s.preference.equals(preference)) return s; - } - return list().get(0); - } - public int index() { - return list().indexOf(this); - } - public static ExportInterpolation getDefault() { - return LINEAR_INTERPOLATION; - } - public String toPreference() { - return preference; - } - private static List toList(T ... ts) { - ArrayList result = new ArrayList(); - for(T t : ts) result.add(t); - return result; - } -} +package org.simantics.history.csv; + +import java.util.ArrayList; +import java.util.List; + +/** + * Specifies the interpolation method to use when producing exported samples in + * {@link CSVFormatter}. + * + * @author Tuukka Lehtonen + * @see CSVFormatter + */ +public enum ExportInterpolation { + + /** + * Directly take the last sample whose time stamp is less than or equal to + * the sampling time. + */ + PREVIOUS_SAMPLE("Previous sample", "previous"), + + /** + *

+	 * v1               vs                   v2
+	 * |----------------|--------------------|
+	 * t1               ts                   t2
+	 * 
+ * + * Here t1 and t2 are time stamps of those two + * successive samples for which t1 ≤ ts ≤ + * t2. + * + *

+ * The sampling result is then: + * vs = v1+(v2-v1)*(ts-t1)/(t2-t1). + */ + LINEAR_INTERPOLATION("Linear interpolation", "lerp"); + + public String label; + public String preference; + ExportInterpolation(String label, String preference) { + this.label = label; + this.preference = preference; + } + public static List list() { + return toList(LINEAR_INTERPOLATION, PREVIOUS_SAMPLE); + } + public static ExportInterpolation fromIndex(int index) { + return list().get(index); + } + public static ExportInterpolation fromPreference(String preference) { + for(ExportInterpolation s : list()) { + if(s.preference.equals(preference)) return s; + } + return list().get(0); + } + public int index() { + return list().indexOf(this); + } + public static ExportInterpolation getDefault() { + return LINEAR_INTERPOLATION; + } + public String toPreference() { + return preference; + } + private static List toList(T ... ts) { + ArrayList result = new ArrayList(); + for(T t : ts) result.add(t); + return result; + } +}