本文整理匯總了Java中edu.cornell.cs.nlp.spf.mr.lambda.mapping.ScopeMapping.peek方法的典型用法代碼示例。如果您正苦於以下問題:Java ScopeMapping.peek方法的具體用法?Java ScopeMapping.peek怎麽用?Java ScopeMapping.peek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.cornell.cs.nlp.spf.mr.lambda.mapping.ScopeMapping
的用法示例。
在下文中一共展示了ScopeMapping.peek方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doEquals
import edu.cornell.cs.nlp.spf.mr.lambda.mapping.ScopeMapping; //導入方法依賴的package包/類
@Override
protected boolean doEquals(LogicalExpression exp,
ScopeMapping<Variable, Variable> mapping) {
if (!(exp instanceof Variable) || exp instanceof SkolemId) {
return false;
}
final Variable mapValue = mapping.peek(this);
if (mapValue == exp && mapping.peekValue(mapValue) == this) {
// Comparison through mapping of variables.
return true;
} else if (!mapping.containsValue((Variable) exp)) {
// Case both are not mapped, do instance comparison for free
// variables.
return exp == this;
} else {
// Not equal.
return false;
}
}
示例2: equals
import edu.cornell.cs.nlp.spf.mr.lambda.mapping.ScopeMapping; //導入方法依賴的package包/類
@Override
public boolean equals(LogicalExpression exp,
ScopeMapping<Variable, Variable> mapping) {
if (!(exp instanceof SkolemId)) {
return false;
}
final Variable mappedValue = mapping.peek(this);
if (mappedValue == exp && mapping.peekValue(mappedValue) == this) {
return true;
} else if (exp instanceof SkolemIdInstanceWrapper) {
return exp.equals(this, mapping);
} else if (!mapping.containsValue((SkolemId) exp)) {
mapping.push(this, (SkolemId) exp);
return true;
} else {
return false;
}
}
示例3: read
import edu.cornell.cs.nlp.spf.mr.lambda.mapping.ScopeMapping; //導入方法依賴的package包/類
@Override
public Variable read(String string,
ScopeMapping<String, LogicalExpression> mapping,
TypeRepository typeRepository, ITypeComparator typeComparator,
LogicalExpressionReader reader) {
try {
final Pair<String, Variable> defintion = readVariableDefintion(
string, typeRepository);
if (defintion != null && !mapping.containsKey(string)) {
mapping.push(defintion.first(), defintion.second());
return defintion.second();
} else if (defintion != null) {
throw new LogicalExpressionRuntimeException(
"Re-define a global variable: " + string);
} else {
// Case variable reference.
if (mapping.containsKey(string)) {
return (Variable) mapping.peek(string);
} else {
throw new LogicalExpressionRuntimeException(
"Undefined variable reference: " + string);
}
}
} catch (final RuntimeException e) {
LOG.error("Variable error: %s", string);
throw e;
}
}
示例4: read
import edu.cornell.cs.nlp.spf.mr.lambda.mapping.ScopeMapping; //導入方法依賴的package包/類
@Override
public SkolemId read(String string,
ScopeMapping<String, LogicalExpression> mapping,
TypeRepository typeRepository, ITypeComparator typeComparator,
LogicalExpressionReader reader) {
if (!mapping.containsKey(string)) {
mapping.push(string, new SkolemId());
}
return (SkolemId) mapping.peek(string);
}