2016-03-06 08:05:32 +00:00
|
|
|
package com.bytezone.diskbrowser.visicalc;
|
|
|
|
|
2017-02-18 09:54:24 +00:00
|
|
|
class Min extends Function
|
2016-03-06 08:05:32 +00:00
|
|
|
{
|
2017-02-18 09:54:24 +00:00
|
|
|
private final Range range;
|
|
|
|
|
2017-03-14 11:28:52 +00:00
|
|
|
public Min (Sheet parent, Cell cell, String text)
|
2016-03-06 08:05:32 +00:00
|
|
|
{
|
2017-03-14 11:28:52 +00:00
|
|
|
super (parent, cell, text);
|
2017-03-03 23:41:08 +00:00
|
|
|
|
2017-03-14 11:28:52 +00:00
|
|
|
System.out.println (text);
|
2017-03-03 10:24:23 +00:00
|
|
|
range = new Range (parent, text);
|
2016-03-06 08:05:32 +00:00
|
|
|
}
|
|
|
|
|
2016-03-12 02:21:00 +00:00
|
|
|
@Override
|
2017-02-28 20:39:26 +00:00
|
|
|
public void calculate ()
|
2016-03-12 02:21:00 +00:00
|
|
|
{
|
2016-03-16 06:15:39 +00:00
|
|
|
value = Double.MAX_VALUE;
|
|
|
|
int totalChecked = 0;
|
2016-03-12 05:05:50 +00:00
|
|
|
|
2016-03-06 08:05:32 +00:00
|
|
|
for (Address address : range)
|
|
|
|
{
|
2016-03-12 02:21:00 +00:00
|
|
|
Cell cell = parent.getCell (address);
|
2017-03-03 23:41:08 +00:00
|
|
|
if (cell.isValueType (ValueType.NA))
|
2016-03-16 06:15:39 +00:00
|
|
|
continue;
|
|
|
|
|
2017-02-25 03:56:22 +00:00
|
|
|
if (!cell.isValueType (ValueType.VALUE))
|
2016-03-12 02:21:00 +00:00
|
|
|
{
|
2017-02-25 03:56:22 +00:00
|
|
|
valueType = cell.getValueType ();
|
2016-03-17 04:40:43 +00:00
|
|
|
break;
|
2016-03-12 02:21:00 +00:00
|
|
|
}
|
2016-03-16 06:15:39 +00:00
|
|
|
|
|
|
|
double temp = cell.getValue ();
|
|
|
|
if (temp < value)
|
|
|
|
value = temp;
|
|
|
|
totalChecked++;
|
2016-03-06 08:05:32 +00:00
|
|
|
}
|
2016-03-16 06:15:39 +00:00
|
|
|
|
|
|
|
if (totalChecked == 0)
|
2016-03-17 04:40:43 +00:00
|
|
|
valueType = ValueType.NA;
|
2016-03-16 19:32:25 +00:00
|
|
|
else
|
|
|
|
valueType = ValueType.VALUE;
|
2016-03-06 08:05:32 +00:00
|
|
|
}
|
|
|
|
}
|