本文整理匯總了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;
}
}