本文整理汇总了C#中DataDictionary.Interpreter.Filter.BaseFilter.AcceptableChoice方法的典型用法代码示例。如果您正苦于以下问题:C# BaseFilter.AcceptableChoice方法的具体用法?C# BaseFilter.AcceptableChoice怎么用?C# BaseFilter.AcceptableChoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataDictionary.Interpreter.Filter.BaseFilter
的用法示例。
在下文中一共展示了BaseFilter.AcceptableChoice方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addReference
/// <summary>
/// Adds a reference which satisfies the provided expectation in the result set
/// </summary>
/// <param name="namable"></param>
/// <param name="expectation"></param>
/// <param name="asType">Indicates that we had to move from instance to type to perform the deferencing</param>
/// <param name="resultSet"></param>
private int addReference(INamable namable, BaseFilter expectation, bool asType, ReturnValue resultSet)
{
int retVal = 0;
if (namable != null)
{
if (expectation.AcceptableChoice(namable))
{
if (asType)
{
if (!(namable is IValue) && !(namable is Type))
{
resultSet.Add(namable);
retVal += 1;
}
else if (namable is State)
{
// TODO : Refactor model to avoid this
resultSet.Add(namable);
retVal += 1;
}
}
else
{
resultSet.Add(namable);
retVal += 1;
}
}
}
return retVal;
}
示例2: Fill
/// <summary>
/// Fills the list provided with the element matching the filter provided
/// </summary>
/// <param name="retVal">The list to be filled with the element matching the condition expressed in the filter</param>
/// <param name="filter">The filter to apply</param>
public void Fill(List<INamable> retVal, BaseFilter filter)
{
if (filter.AcceptableChoice(Ref))
{
retVal.Add(Ref);
}
}
示例3: Fill
/// <summary>
/// Fills the list provided with the element matching the filter provided
/// </summary>
/// <param name="retVal">The list to be filled with the element matching the condition expressed in the filter</param>
/// <param name="filter">The filter to apply</param>
public override void Fill(List<INamable> retVal, BaseFilter filter)
{
if (Parameters != null)
{
foreach (Parameter parameter in Parameters)
{
if (filter.AcceptableChoice(parameter))
{
retVal.Add(parameter);
}
}
}
if (Expression != null)
{
Expression.Fill(retVal, filter);
}
}
示例4: Fill
/// <summary>
/// Fills the list provided with the element matching the filter provided
/// </summary>
/// <param name="retVal">The list to be filled with the element matching the condition expressed in the filter</param>
/// <param name="filter">The filter to apply</param>
public override void Fill(List<INamable> retVal, BaseFilter filter)
{
if (filter.AcceptableChoice(Value))
{
retVal.Add(Value);
}
}
示例5: Filter
/// <summary>
/// Filters out value according to predicate
/// </summary>
/// <param name="accept"></param>
public void Filter(BaseFilter accept)
{
ApplyUpdates();
DiscardRemoved();
// Only keep the most specific elements.
string mostSpecific = null;
foreach (ReturnValueElement element in Values)
{
if (accept.AcceptableChoice(element.Value))
{
if (mostSpecific == null)
{
mostSpecific = element.Value.FullName;
}
else
{
if (mostSpecific.Length < element.Value.FullName.Length)
{
mostSpecific = element.Value.FullName;
}
}
}
}
// if the filtering is about variables, ensure that there is at least one variable in the element chain
if (accept is IsVariable)
{
List<ReturnValueElement> tmp = new List<ReturnValueElement>();
foreach (ReturnValueElement element in Values)
{
bool variableFound = false;
bool onlyStructureElement = true;
ReturnValueElement current = element;
while (!variableFound && current != null)
{
variableFound = IsStrictVariableOrValue.INSTANCE.AcceptableChoice(current.Value) ||
current.AsType;
onlyStructureElement = onlyStructureElement && current.Value is StructureElement;
current = current.PreviousElement;
}
if (variableFound)
{
tmp.Add(element);
}
else if (onlyStructureElement)
{
tmp.Add(element);
}
}
// HaCK : If tmp is empty, this indicates that the filter above is too restrictive.
// Keep the original set
if (tmp.Count > 0)
{
Values = tmp;
}
}
// Build a new list with the filtered out elements
bool variable = false;
{
List<ReturnValueElement> tmp = new List<ReturnValueElement>();
foreach (ReturnValueElement element in Values)
{
if (accept.AcceptableChoice(element.Value) &&
(mostSpecific == null || mostSpecific.Equals(element.Value.FullName)))
{
tmp.Add(element);
variable = variable || element.Value is IVariable;
}
}
Values = tmp;
}
// HaCK : If both Variable and StructureElement are found, only keep the variable
if (variable)
{
List<ReturnValueElement> tmp = new List<ReturnValueElement>();
foreach (ReturnValueElement element in Values)
{
if (!(element.Value is StructureElement) && !(element.Value is Type))
{
tmp.Add(element);
}
}
Values = tmp;
}
}