本文整理汇总了C#中Conditions.add方法的典型用法代码示例。如果您正苦于以下问题:C# Conditions.add方法的具体用法?C# Conditions.add怎么用?C# Conditions.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Conditions
的用法示例。
在下文中一共展示了Conditions.add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseElement
public override void ParseElement(XmlElement element)
{
XmlNodeList
eithers = element.SelectNodes("either"),
actives = element.SelectNodes("active"),
inactives = element.SelectNodes("inactive"),
greatersthan = element.SelectNodes("greater-than"),
greatersequalssthan = element.SelectNodes("greater-equals-than"),
lesssthan = element.SelectNodes("less-than"),
lesssequalssthan = element.SelectNodes("less-equals-than"),
equalss = element.SelectNodes("equals"),
notsequals = element.SelectNodes("not-equals"),
globalsstatesref = element.SelectNodes("global-state-ref");
string tmpArgVal;
foreach (XmlElement el in eithers)
{
currentEitherCondition = new Conditions();
//Embeded inside eithers
XmlNodeList
actives_e = el.SelectNodes("active"),
inactives_e = el.SelectNodes("inactive"),
greatersthan_e = el.SelectNodes("greater-than"),
greatersequalssthan_e = el.SelectNodes("greater-equals-than"),
lesssthan_e = el.SelectNodes("less-than"),
lesssequalssthan_e = el.SelectNodes("less-equals-than"),
equalss_e = el.SelectNodes("equals"),
notsequals_e = el.SelectNodes("not-equals"),
globalsstatesref_e = el.SelectNodes("global-state-ref");
foreach (XmlElement ell in actives_e)
{
tmpArgVal = ell.GetAttribute("flag");
if (!string.IsNullOrEmpty(tmpArgVal))
{
currentEitherCondition.add(new FlagCondition(tmpArgVal, FlagCondition.FLAG_ACTIVE));
chapter.addFlag(tmpArgVal);
}
}
foreach (XmlElement ell in inactives_e)
{
tmpArgVal = ell.GetAttribute("flag");
if (!string.IsNullOrEmpty(tmpArgVal))
{
currentEitherCondition.add(new FlagCondition(tmpArgVal, FlagCondition.FLAG_INACTIVE));
chapter.addFlag(tmpArgVal);
}
}
foreach (XmlElement ell in greatersthan_e)
{
// The var
string var = null;
// The value
int value = 0;
tmpArgVal = ell.GetAttribute("var");
if (!string.IsNullOrEmpty(tmpArgVal))
{
var = tmpArgVal;
}
tmpArgVal = ell.GetAttribute("value");
if (!string.IsNullOrEmpty(tmpArgVal))
{
value = int.Parse(tmpArgVal);
}
currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_GREATER_THAN, value));
chapter.addVar(var);
}
foreach (XmlElement ell in greatersequalssthan_e)
{
// The var
string var = null;
// The value
int value = 0;
tmpArgVal = ell.GetAttribute("var");
if (!string.IsNullOrEmpty(tmpArgVal))
{
var = tmpArgVal;
}
tmpArgVal = ell.GetAttribute("value");
if (!string.IsNullOrEmpty(tmpArgVal))
{
value = int.Parse(tmpArgVal);
}
currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_GREATER_EQUALS_THAN, value));
chapter.addVar(var);
}
foreach (XmlElement ell in lesssthan_e)
{
// The var
string var = null;
// The value
int value = 0;
//.........这里部分代码省略.........
示例2: getEitherConditions
/**
* Returns a list with all the either condition blocks. This method is only
* held for past compatibility
*
* @return List of conditions
*/
private List<Conditions> getEitherConditions()
{
List<Conditions> conditions = new List<Conditions>();
foreach (List<Condition> wrapper in conditionsList)
{
if (wrapper.Count > 1)
{
Conditions eitherBlock = new Conditions();
foreach (Condition condition in wrapper)
{
eitherBlock.add(condition);
}
conditions.Add(eitherBlock);
}
}
return conditions;
}