dmolony-DiskBrowser/src/com/bytezone/diskbrowser/visicalc/Abs.java

29 lines
576 B
Java
Raw Normal View History

2016-03-15 04:40:57 +00:00
package com.bytezone.diskbrowser.visicalc;
public class Abs extends Function
{
Abs (Cell cell, String text)
2016-03-15 04:40:57 +00:00
{
super (cell, text);
2017-03-03 23:41:08 +00:00
2017-03-18 09:21:11 +00:00
assert text.startsWith ("@ABS(") : text;
2017-03-19 01:03:57 +00:00
source = cell.getExpressionValue (functionText);
2017-03-03 23:41:08 +00:00
values.add (source);
2016-03-15 04:40:57 +00:00
}
2016-03-15 20:06:04 +00:00
@Override
2017-02-28 20:39:26 +00:00
public void calculate ()
2016-03-15 04:40:57 +00:00
{
2017-03-03 23:41:08 +00:00
source.calculate ();
2017-02-25 03:56:22 +00:00
2017-03-18 21:23:44 +00:00
if (!source.isValueType (ValueType.VALUE))
{
valueType = source.getValueType ();
return;
}
2017-02-25 03:56:22 +00:00
value = Math.abs (source.getValue ());
2017-03-18 21:23:44 +00:00
valueType = Double.isNaN (value) ? ValueType.ERROR : ValueType.VALUE;
2016-03-15 04:40:57 +00:00
}
}