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

42 lines
683 B
Java
Raw Normal View History

2016-03-10 09:21:47 +00:00
package com.bytezone.diskbrowser.visicalc;
2016-03-12 22:38:03 +00:00
class Or extends Function
2016-03-10 09:21:47 +00:00
{
2017-03-20 01:45:14 +00:00
private final ConditionList conditions;
2017-02-25 03:56:22 +00:00
public Or (Cell cell, String text)
2016-03-10 09:21:47 +00:00
{
super (cell, text);
2017-03-03 23:41:08 +00:00
2017-03-18 09:21:11 +00:00
assert text.startsWith ("@OR(") : text;
2017-03-19 03:49:14 +00:00
conditions = new ConditionList (cell, functionText);
2016-03-10 09:21:47 +00:00
}
@Override
2017-02-28 20:39:26 +00:00
public void calculate ()
2016-03-10 09:21:47 +00:00
{
2017-02-25 03:56:22 +00:00
for (Condition condition : conditions)
2017-02-26 10:44:10 +00:00
{
condition.calculate ();
if (condition.getValue () == 1)
2017-02-25 03:56:22 +00:00
{
value = 1;
2017-02-28 20:39:26 +00:00
return;
2017-02-25 03:56:22 +00:00
}
2017-02-26 10:44:10 +00:00
}
2016-03-16 06:15:39 +00:00
value = 0;
2016-03-10 09:21:47 +00:00
}
2017-03-18 00:24:05 +00:00
@Override
public boolean isBoolean ()
{
return true;
}
@Override
public String getText ()
{
return value == 0 ? "FALSE" : "TRUE";
}
2016-03-10 09:21:47 +00:00
}