public override string ToPython()
{
// If there is no sub conditions, return true by default...
if (SubConditions.Count == 0)
return "true";
// If there is only 1 sub condition in a AND list, just return it
else if (Type == ConditionType.And && SubConditions.Count == 1)
return SubConditions[0].ToPython();
StringBuilder SB = new StringBuilder();
switch (Type)
{
case ConditionType.And:
SB.Append("f_and(");
break;
case ConditionType.Div:
SB.Append("f_div(");
break;
case ConditionType.Not:
SB.Append("f_not(");
break;
case ConditionType.Or:
SB.Append("f_or(");
break;
case ConditionType.Plus:
SB.Append("f_plus(");
break;
}
foreach (Condition C in SubConditions)
SB.Append(C.ToPython() + ", ");
return SB.ToString().TrimEnd(new char[2] { ',', ' ' }) + ")";
}