本文整理汇总了C#中SemWeb.Statement.Matches方法的典型用法代码示例。如果您正苦于以下问题:C# Statement.Matches方法的具体用法?C# Statement.Matches怎么用?C# Statement.Matches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SemWeb.Statement
的用法示例。
在下文中一共展示了Statement.Matches方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Remove
public override void Remove(Statement statement) {
if (statement.AnyNull) {
for (int i = 0; i < statements.Count; i++) {
Statement s = (Statement)statements[i];
if (statement.Matches(s)) {
statements.RemoveAt(i); i--;
if (isIndexed) {
GetIndexArray(statementsAboutSubject, s.Subject).Remove(s);
GetIndexArray(statementsAboutObject, s.Object).Remove(s);
}
}
}
} else {
statements.Remove(statement);
if (isIndexed) {
GetIndexArray(statementsAboutSubject, statement.Subject).Remove(statement);
GetIndexArray(statementsAboutObject, statement.Object).Remove(statement);
}
}
}
示例2: Select
public override void Select(Statement template, StatementSink result) {
StatementList source = statements;
// The first time select is called, turn indexing on for the store.
// TODO: Perform this index in a background thread if there are a lot
// of statements.
if (!isIndexed && allowIndexing) {
isIndexed = true;
for (int i = 0; i < StatementCount; i++) {
Statement statement = this[i];
GetIndexArray(statementsAboutSubject, statement.Subject).Add(statement);
GetIndexArray(statementsAboutObject, statement.Object).Add(statement);
}
}
if (template.Subject != null) ShorterList(ref source, GetIndexArray(statementsAboutSubject, template.Subject));
else if (template.Object != null) ShorterList(ref source, GetIndexArray(statementsAboutObject, template.Object));
if (source == null) return;
for (int i = 0; i < source.Count; i++) {
Statement statement = source[i];
if (!template.Matches(statement))
continue;
if (!result.Add(statement)) return;
}
}