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

30 lines
591 B
Java
Raw Normal View History

2016-03-10 09:21:47 +00:00
package com.bytezone.diskbrowser.visicalc;
2017-02-25 03:56:22 +00:00
import java.util.ArrayList;
import java.util.List;
2016-03-12 22:38:03 +00:00
class And extends Function
2016-03-10 09:21:47 +00:00
{
2017-02-25 03:56:22 +00:00
List<Condition> conditions = new ArrayList<Condition> ();
2016-03-10 09:21:47 +00:00
public And (Sheet parent, String text)
{
super (parent, text);
2017-02-25 03:56:22 +00:00
String list[] = text.split (",");
for (String s : list)
conditions.add (new Condition (parent, s));
2016-03-10 09:21:47 +00:00
}
@Override
2016-03-17 04:40:43 +00:00
public Value calculate ()
2016-03-10 09:21:47 +00:00
{
2017-02-25 03:56:22 +00:00
for (Condition condition : conditions)
if (!condition.getResult ())
{
value = 0;
return this;
}
value = 1;
2016-03-17 04:40:43 +00:00
return this;
2016-03-10 09:21:47 +00:00
}
}