-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathANDCondition.cs
More file actions
40 lines (33 loc) · 948 Bytes
/
ANDCondition.cs
File metadata and controls
40 lines (33 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Text;
using System.Diagnostics;
namespace aima.core.agent.impl.aprog.simplerule
{
/**
* Implementation of an AND condition.
*
* @author Ciaran O'Reilly
*
*/
public class ANDCondition : Condition
{
private Condition left;
private Condition right;
public ANDCondition(Condition leftCon, Condition rightCon)
{
Debug.Assert(null != leftCon);
Debug.Assert(null != rightCon);
left = leftCon;
right = rightCon;
}
public override bool evaluate(ObjectWithDynamicAttributes p)
{
return (left.evaluate(p) && right.evaluate(p));
}
public override String ToString()
{
StringBuilder sb = new StringBuilder();
return sb.Append("[").Append(left).Append(" && ").Append(right).Append(
"]").ToString();
}
}
}