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

37 lines
1.1 KiB
Java
Raw Normal View History

2016-03-06 08:05:32 +00:00
package com.bytezone.diskbrowser.visicalc;
2017-03-15 04:40:18 +00:00
import com.bytezone.diskbrowser.visicalc.Cell.CellType;
2020-02-10 11:05:40 +00:00
// -----------------------------------------------------------------------------------//
2017-03-19 23:33:23 +00:00
class Count extends ValueListFunction
2020-02-10 11:05:40 +00:00
// -----------------------------------------------------------------------------------//
2016-03-06 08:05:32 +00:00
{
2020-02-10 11:05:40 +00:00
// ---------------------------------------------------------------------------------//
Count (Cell cell, String text)
// ---------------------------------------------------------------------------------//
2016-03-06 08:05:32 +00:00
{
super (cell, text);
2017-03-26 09:16:36 +00:00
2017-03-18 09:21:11 +00:00
assert text.startsWith ("@COUNT(") : text;
2016-03-06 08:05:32 +00:00
}
2020-02-10 11:05:40 +00:00
// ---------------------------------------------------------------------------------//
2016-03-12 05:05:50 +00:00
@Override
2017-02-28 20:39:26 +00:00
public void calculate ()
2020-02-10 11:05:40 +00:00
// ---------------------------------------------------------------------------------//
2016-03-12 05:05:50 +00:00
{
2016-03-16 06:15:39 +00:00
value = 0;
2016-03-17 04:40:43 +00:00
2017-03-15 00:41:45 +00:00
if (!isRange)
value = list.size ();
else
for (Value v : list)
{
2021-09-19 07:09:34 +00:00
if (v instanceof Cell cell && cell.isCellType (CellType.EMPTY))
2017-03-15 00:41:45 +00:00
continue;
2016-03-17 04:40:43 +00:00
2017-03-15 07:07:36 +00:00
v.calculate (); // is this required?
2017-03-15 00:41:45 +00:00
value++;
}
2016-03-06 08:05:32 +00:00
}
}