]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.utils/src/org/simantics/utils/format/SwitchFormat.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.utils / src / org / simantics / utils / format / SwitchFormat.java
index 28e28e6ebf55cfd8450398bd16a073cf94600a4e..cdf3d751664c6acb3b37fe6830c2fa9f58a267ee 100644 (file)
@@ -1,67 +1,67 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
- * Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.utils.format;\r
-\r
-import java.text.FieldPosition;\r
-import java.text.NumberFormat;\r
-import java.text.ParsePosition;\r
-\r
-public class SwitchFormat extends NumberFormat {\r
-\r
-       private static final long serialVersionUID = -205210065554444251L;\r
-\r
-       double low;\r
-       double high;\r
-       NumberFormat lowFormat;\r
-       NumberFormat middleFormat;\r
-       NumberFormat highFormat;\r
-       \r
-       public SwitchFormat(double low, double high, NumberFormat lowFormat, NumberFormat middleFormat, NumberFormat highFormat)\r
-       {\r
-               this.low = low;\r
-               this.high = high;\r
-               this.lowFormat = lowFormat;\r
-               this.middleFormat = middleFormat;\r
-               this.highFormat = highFormat;\r
-       }\r
-       \r
-       @Override\r
-       public StringBuffer format(double number, StringBuffer toAppendTo,\r
-                       FieldPosition pos) {\r
-               \r
-               NumberFormat f;\r
-               double x = Math.abs(number);\r
-               if (x==0.0) f = middleFormat; else\r
-               if (x<=low) f = lowFormat; else\r
-               if (x>=high) f = highFormat; else f = middleFormat;\r
-               \r
-               return f.format(number, toAppendTo, pos);\r
-       }\r
-\r
-       @Override\r
-       public StringBuffer format(long number, StringBuffer toAppendTo,\r
-                       FieldPosition pos) {\r
-               NumberFormat f;\r
-               double x = Math.abs(number);\r
-               if (x==0.0) f = middleFormat; else\r
-               if (x<=low) f = lowFormat; else\r
-               if (x>=high) f = highFormat; else f = middleFormat;\r
-               \r
-               return f.format(number, toAppendTo, pos);\r
-       }\r
-\r
-       @Override\r
-       public Number parse(String source, ParsePosition parsePosition) {\r
-               return 0;\r
-       }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
+ * Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.utils.format;
+
+import java.text.FieldPosition;
+import java.text.NumberFormat;
+import java.text.ParsePosition;
+
+public class SwitchFormat extends NumberFormat {
+
+       private static final long serialVersionUID = -205210065554444251L;
+
+       double low;
+       double high;
+       NumberFormat lowFormat;
+       NumberFormat middleFormat;
+       NumberFormat highFormat;
+       
+       public SwitchFormat(double low, double high, NumberFormat lowFormat, NumberFormat middleFormat, NumberFormat highFormat)
+       {
+               this.low = low;
+               this.high = high;
+               this.lowFormat = lowFormat;
+               this.middleFormat = middleFormat;
+               this.highFormat = highFormat;
+       }
+       
+       @Override
+       public StringBuffer format(double number, StringBuffer toAppendTo,
+                       FieldPosition pos) {
+               
+               NumberFormat f;
+               double x = Math.abs(number);
+               if (x==0.0) f = middleFormat; else
+               if (x<=low) f = lowFormat; else
+               if (x>=high) f = highFormat; else f = middleFormat;
+               
+               return f.format(number, toAppendTo, pos);
+       }
+
+       @Override
+       public StringBuffer format(long number, StringBuffer toAppendTo,
+                       FieldPosition pos) {
+               NumberFormat f;
+               double x = Math.abs(number);
+               if (x==0.0) f = middleFormat; else
+               if (x<=low) f = lowFormat; else
+               if (x>=high) f = highFormat; else f = middleFormat;
+               
+               return f.format(number, toAppendTo, pos);
+       }
+
+       @Override
+       public Number parse(String source, ParsePosition parsePosition) {
+               return 0;
+       }
+
+}