本文整理汇总了Java中gnu.lists.Pair.getCdr方法的典型用法代码示例。如果您正苦于以下问题:Java Pair.getCdr方法的具体用法?Java Pair.getCdr怎么用?Java Pair.getCdr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.lists.Pair
的用法示例。
在下文中一共展示了Pair.getCdr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import gnu.lists.Pair; //导入方法依赖的package包/类
public Object evaluate(Object clauses, Translator tr) {
while (clauses instanceof Pair) {
Pair pclauses = (Pair) clauses;
Object clause = pclauses.getCar();
clauses = pclauses.getCdr();
if (! (clause instanceof Pair))
tr.errorWithPosition("cond-expand clauses is not a list",
pclauses);
Pair pclause = (Pair) clause;
Object test = Translator.stripSyntax(pclause.getCar());
if ((test == elseSymbol && clauses == LList.Empty)
|| evaluateConditionCar(pclause, tr))
return pclause.getCdr();
}
tr.errorIfNonEmpty(clauses);
return LList.Empty;
}
示例2: deepCopyLList
import gnu.lists.Pair; //导入方法依赖的package包/类
private static Serializable deepCopyLList(LList obj) {
Object rest = obj;
List<Serializable> l = new ArrayList<>();
while (true) {
if (rest == LList.Empty)
break;
if (rest instanceof Pair) {
Pair pair = (Pair) rest;
l.add(deepCopy(pair.getCar()));
rest = pair.getCdr();
} else {
l.add(deepCopy(rest));
break;
}
}
return (Serializable) l;
}
示例3: llistToLiteral
import gnu.lists.Pair; //导入方法依赖的package包/类
private static String llistToLiteral(ToExpressionStyle style, LList obj) {
if (obj == null) {
return "#!null";
}
Object rest = obj;
StringBuffer sbuf = new StringBuffer(100);
sbuf.append("(list ");
for (int i = 0;;) {
if (rest == LList.Empty)
break;
if (i > 0)
sbuf.append(' ');
if (rest instanceof Pair) {
Pair pair = (Pair) rest;
sbuf.append(toLiteral(style, pair.getCar()));
rest = pair.getCdr();
} else {
sbuf.append(". ");
sbuf.append(toLiteral(style, rest));
break;
}
i++;
}
sbuf.append(')');
return sbuf.toString();
}
示例4: proc
import gnu.lists.Pair; //导入方法依赖的package包/类
private static void proc(LList args, Map<Keyword, Object> argsMap) {
if (!(args instanceof Pair)) {
return;
}
Pair p = (Pair) args;
Object car = p.getCar();
LList cdr = ((LList) p.getCdr());
if (car instanceof Keyword) {
argsMap.put((Keyword) car, ((Pair) cdr).getCar());
} else {
argsMap.put(Keyword.make("rest"), new ArrayList<Object>(Arrays.asList(args.toArray())));
return;
}
proc((LList) ((Pair) cdr).getCdr(), argsMap);
}
示例5: procAttrsForInsert
import gnu.lists.Pair; //导入方法依赖的package包/类
protected void procAttrsForInsert(ActorObject target, int roundnum, List<String> attrNames,
List<Object> vals) {
RoundHistory r = target.getHistory().getRoundHistory(roundnum);
for (Pair pair : target.getAttributeAndFieldNamePairs()) {
Symbol key = (Symbol) pair.getCdr();
attrNames.add(key.toString());
Serializable val = r.get(key);
if (IntNum.class.isAssignableFrom(val.getClass())) {
vals.add(((IntNum) val).intValue());
} else if (DFloNum.class.isAssignableFrom(val.getClass())) {
vals.add(((DFloNum) val).doubleValue());
} else if (Number.class.isAssignableFrom(val.getClass())) {
vals.add(val);
} else {
vals.add(val.toString());
}
}
}