SEDouble.java
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
3  * All rights reserved. This program is made available under the terms of the
4  * Eclipse Public License v1.0 which accompanies this distribution, and is
5  * available at http://www.eclipse.org/legal/epl-v10.html
6  * Contributors:
7  * General Robotix Inc.
8  * National Institute of Advanced Industrial Science and Technology (AIST)
9  */
16 package com.generalrobotix.ui.view.graph;
17 
18 import java.text.DecimalFormat;
19 
20 public class SEDouble implements StringExchangeable {
21  Double value_;
22  DecimalFormat df_;
23  boolean isNaN_;
24 
30  public SEDouble(double value) {
31  value_ = new Double(value);
32  df_ = new DecimalFormat("0.######");
33  };
34 
35  public SEDouble(String value) {
36  if (value.equals("NaN") || value.equals("")) {
37  isNaN_ = true;
38  value_ = new Double(Double.NaN);
39  } else {
40  value_ = new Double(value);
41  }
42  df_ = new DecimalFormat("0.######");
43  }
44 
50  public String toString() {
51  if (isNaN_) {
52  return "";
53  } else {
54  return df_.format(value_.doubleValue());
55  }
56  }
57 
63  public Object fromString(String str) {
64  if (str.equals("NaN") || str.equals("")) {
65  isNaN_ = true;
66  value_ = new Double(Double.NaN);
67  } else {
68  value_ = new Double(str);
69  }
70  return (Object)value_;
71  }
72 
77  public void setValue(Object value) {
78  value_ = (Double)value;
79  }
80 
85  public void setValue(String str) {
86  value_ = new Double(str);
87  }
88 
89  public void setValue(double value) {
90  value_ = new Double(value);
91  }
92 
97  public Object getValue() {
98  return (Object)value_;
99  }
100 
101  public double doubleValue() {
102  return value_.doubleValue();
103  }
104 
105  public float floatValue() {
106  return value_.floatValue();
107  }
108 }
com.generalrobotix.ui.view.graph.SEDouble.floatValue
float floatValue()
Definition: SEDouble.java:105
com.generalrobotix.ui.view.graph.SEDouble.getValue
Object getValue()
Definition: SEDouble.java:97
com.generalrobotix.ui.view.graph.SEDouble.setValue
void setValue(String str)
Definition: SEDouble.java:85
com.generalrobotix.ui.view.graph.SEDouble.setValue
void setValue(Object value)
Definition: SEDouble.java:77
value
png_voidp int value
Definition: png.h:2110
com.generalrobotix.ui.view.graph.StringExchangeable
Definition: StringExchangeable.java:19
com.generalrobotix.ui.view.graph.SEDouble
Definition: SEDouble.java:20
com.generalrobotix.ui.view.graph.SEDouble.toString
String toString()
Definition: SEDouble.java:50
com.generalrobotix.ui.view.graph.SEDouble.setValue
void setValue(double value)
Definition: SEDouble.java:89
com.generalrobotix.ui.view.graph.SEDouble.SEDouble
SEDouble(double value)
Definition: SEDouble.java:30
com.generalrobotix.ui.view.graph.SEDouble.fromString
Object fromString(String str)
Definition: SEDouble.java:63
com.generalrobotix.ui.view.graph.SEDouble.SEDouble
SEDouble(String value)
Definition: SEDouble.java:35
com.generalrobotix.ui.view.graph.SEDouble.doubleValue
double doubleValue()
Definition: SEDouble.java:101


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Wed Sep 7 2022 02:51:04