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

41 lines
1.1 KiB
Java
Raw Normal View History

2016-03-10 09:21:47 +00:00
package com.bytezone.diskbrowser.visicalc;
2020-02-10 11:05:40 +00:00
// -----------------------------------------------------------------------------------//
2017-03-23 13:30:41 +00:00
class And extends ConditionListFunction
2020-02-10 11:05:40 +00:00
// -----------------------------------------------------------------------------------//
2016-03-10 09:21:47 +00:00
{
2020-02-10 11:05:40 +00:00
// ---------------------------------------------------------------------------------//
And (Cell cell, String text)
// ---------------------------------------------------------------------------------//
2016-03-10 09:21:47 +00:00
{
super (cell, text);
2017-03-18 09:21:11 +00:00
assert text.startsWith ("@AND(") : text;
2016-03-10 09:21:47 +00:00
}
2020-02-10 11:05:40 +00:00
// ---------------------------------------------------------------------------------//
2016-03-10 09:21:47 +00:00
@Override
2017-02-28 20:39:26 +00:00
public void calculate ()
2020-02-10 11:05:40 +00:00
// ---------------------------------------------------------------------------------//
2016-03-10 09:21:47 +00:00
{
2017-03-25 21:58:10 +00:00
valueResult = ValueResult.VALID;
2017-03-23 13:30:41 +00:00
for (Value condition : conditions)
2017-02-26 10:44:10 +00:00
{
condition.calculate ();
2017-03-25 08:02:02 +00:00
if (condition.getValueType () != ValueType.BOOLEAN)
{
valueResult = ValueResult.ERROR;
return;
}
2017-03-23 13:30:41 +00:00
if (!condition.getBoolean ())
2017-02-25 03:56:22 +00:00
{
2017-03-23 13:30:41 +00:00
bool = false;
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
}
2017-03-25 21:58:10 +00:00
2017-03-23 13:30:41 +00:00
bool = true;
2017-03-18 00:24:05 +00:00
}
2016-03-10 09:21:47 +00:00
}