mirror of
https://github.com/dmolony/DiskBrowser.git
synced 2024-06-12 15:29:28 +00:00
44 lines
826 B
Java
44 lines
826 B
Java
package com.bytezone.diskbrowser.visicalc;
|
|
|
|
class Min extends Function
|
|
{
|
|
private final Range range;
|
|
|
|
public Min (Sheet parent, String text)
|
|
{
|
|
super (parent, text);
|
|
range = new Range (text);
|
|
}
|
|
|
|
@Override
|
|
public Value calculate ()
|
|
{
|
|
value = Double.MAX_VALUE;
|
|
int totalChecked = 0;
|
|
|
|
for (Address address : range)
|
|
{
|
|
Cell cell = parent.getCell (address);
|
|
if (cell == null || cell.isValueType (ValueType.NA))
|
|
continue;
|
|
|
|
if (cell.isValueType (ValueType.ERROR))
|
|
{
|
|
valueType = ValueType.ERROR;
|
|
break;
|
|
}
|
|
|
|
double temp = cell.getValue ();
|
|
if (temp < value)
|
|
value = temp;
|
|
totalChecked++;
|
|
}
|
|
|
|
if (totalChecked == 0)
|
|
valueType = ValueType.NA;
|
|
else
|
|
valueType = ValueType.VALUE;
|
|
|
|
return this;
|
|
}
|
|
} |