• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中gnu.lists.LList的典型用法代码示例。如果您正苦于以下问题:Java LList类的具体用法?Java LList怎么用?Java LList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LList类属于gnu.lists包,在下文中一共展示了LList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: evaluate

import gnu.lists.LList; //导入依赖的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;
}
 
开发者ID:spurious,项目名称:kawa-mirror,代码行数:18,代码来源:IfFeature.java


示例2: main

import gnu.lists.LList; //导入依赖的package包/类
public static void main(String[] args) throws Throwable{
	Scheme s = Scheme.getInstance();
	s.defineFunction("f", new Procedure2() {
		@Override
		public Object apply2(Object arg0, Object arg1) throws Throwable {
			String[] names = {"hello", "world"};
			@SuppressWarnings("unchecked")
			String[] values = ConvertUtils.namesToValues((LList)arg0, (Map<String, String>)arg1);
			for(int i = 0; i < 2; i++){
				System.out.println(names[i] + " => " + values[i]);
			}
			return null;
		}
	});
	s.eval(String.format(
			"(require 'hash-table)(let ((h (make-hash-table)))"
			+ "(hash-table-set! h \"hello\" \"world\")"
			+ "(hash-table-set! h \"hello2\" \"world2\")"
			+ "(f '(\"hello\" \"world\") h))"
			));
}
 
开发者ID:MAGCruise,项目名称:magcruise-broker,代码行数:22,代码来源:RunScheme_hash_table.java


示例3: createMessageForGetAndEvalScripts

import gnu.lists.LList; //导入依赖的package包/类
private String createMessageForGetAndEvalScripts(LList urlsOrScripts) {
	if (urlsOrScripts.isEmpty()) {
		return "";
	}
	Pair p = (Pair) urlsOrScripts;
	String e = (String) p.getCar();

	if (e.startsWith("http:") || e.startsWith("/")) {
		return String
				.format("$.getScript($.inArray('%s', loadedScripts)==-1?'%s':null)"
						+ ".always(function(script, textStatus) {"
						+ "%s" + "});"
						+ "if($.inArray('%s', loadedScripts)==-1){loadedScripts.push('%s');}",
						e, e,
						createMessageForGetAndEvalScripts((LList) p.getCdr()), e, e);
	} else {
		return e + System.lineSeparator()
				+ createMessageForGetAndEvalScripts((LList) p.getCdr());
	}

}
 
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:22,代码来源:Player.java


示例4: create

import gnu.lists.LList; //导入依赖的package包/类
public static MultipleDefTasks create(LList args) {
	log.debug(args);
	List<DefTask> result = new ArrayList<>();
	Map<Keyword, Object> argsMap = LiteralUtils.createArgsMap(args);

	Object actor = argsMap.getOrDefault(Keyword.make("actor"), Symbol.parse("Context"));
	Symbol action = (Symbol) argsMap.get(Keyword.make("action"));
	Symbol type = (Symbol) argsMap.getOrDefault(Keyword.make("type"), Symbol.parse("default"));
	if (action == null) {
		throw new RuntimeException("action is required.");
	}

	if (actor instanceof List) {
		((List<?>) actor).forEach(a -> {
			result.add(createTask(argsMap, type, ActorName.of((Symbol) a), action));
		});

	} else if (actor instanceof Symbol) {
		result.add(createTask(argsMap, type, ActorName.of((Symbol) actor), action));
	}

	return new MultipleDefTasks(result);
}
 
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:24,代码来源:DefTaskFactory.java


示例5: create

import gnu.lists.LList; //导入依赖的package包/类
public static MultipleDefRounds create(LList args) {
	log.debug(args);
	List<DefRound> result = new ArrayList<>();
	Map<Keyword, Object> argsMap = LiteralUtils.createArgsMap(args);

	int repeat = ((Number) argsMap.getOrDefault(Keyword.make("repeat"), 1)).intValue();
	Symbol name = (Symbol) argsMap.getOrDefault(Keyword.make("name"),
			Symbol.parse(String.valueOf(System.currentTimeMillis())));
	@SuppressWarnings("unchecked")
	List<DefStage> rest = (List<DefStage>) argsMap.getOrDefault(Keyword.make("rest"),
			new ArrayList<>());

	for (int i = 0; i < repeat; i++) {
		result.add(new DefRound(name.toString(), rest));
	}

	return new MultipleDefRounds(result);
}
 
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:19,代码来源:DefRoundFactory.java


示例6: create

import gnu.lists.LList; //导入依赖的package包/类
public static MultipleDefStages create(LList args) {
	log.debug(args);
	List<DefStage> result = new ArrayList<>();
	Map<Keyword, Object> argsMap = LiteralUtils.createArgsMap(args);

	Symbol type = (Symbol) argsMap.getOrDefault(Keyword.make("type"),
			Symbol.parse("sequential"));
	Symbol name = (Symbol) argsMap.getOrDefault(Keyword.make("name"),
			Symbol.parse(String.valueOf(System.currentTimeMillis())));
	@SuppressWarnings("unchecked")
	List<StageElement> rest = (List<StageElement>) argsMap.getOrDefault(Keyword.make("rest"),
			new ArrayList<>());
	switch (type.toString()) {
	case "sequential":
		result.add(new DefSequentialStage(name, rest));
		break;
	case "parallel":
		result.add(new DefParallelStage(name, rest));
		break;
	default:
		result.add(new DefSequentialStage(name, rest));
	}

	return new MultipleDefStages(result);
}
 
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:26,代码来源:DefStageFactory.java


示例7: deepCopyLList

import gnu.lists.LList; //导入依赖的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;
}
 
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:18,代码来源:LiteralUtils.java


示例8: llistToLiteral

import gnu.lists.LList; //导入依赖的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();
}
 
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:27,代码来源:LiteralUtils.java


示例9: proc

import gnu.lists.LList; //导入依赖的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);
}
 
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:17,代码来源:LiteralUtils.java


示例10: toArray

import gnu.lists.LList; //导入依赖的package包/类
/**
 * Return this YailList as an array.
 */
@Override
public Object[] toArray() {
  if (cdr instanceof Pair) {
    return ((Pair) cdr).toArray();
  } else if (cdr instanceof LList) {
    return ((LList) cdr).toArray();
  } else {
    throw new YailRuntimeError("YailList cannot be represented as an array", "YailList Error.");
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:14,代码来源:YailList.java


示例11: toString

import gnu.lists.LList; //导入依赖的package包/类
/**
 * Return a String representation of this YailList.
 */
@Override
public String toString() {
  if (cdr instanceof Pair) {
    return ((Pair) cdr).toString();
  } else if (cdr instanceof LList) {
    return ((LList) cdr).toString();
  } else {
    throw new RuntimeException("YailList cannot be represented as a String");
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:14,代码来源:YailList.java


示例12: readVector

import gnu.lists.LList; //导入依赖的package包/类
public static FVector readVector(LispReader lexer, InPort port, int count, char close, int sharingIndex)
   throws java.io.IOException, SyntaxException
 {
   char saveReadState = ' ';
   if (port instanceof InPort)
     {	
saveReadState = ((InPort) port).readState;
((InPort) port).readState = close == ']' ? '[' : '(';
     }
   int startLine = port.getLineNumber();
   int startColumn = port.getColumnNumber()-1;
    try
      {
        FVector result = new FVector();
        lexer.bindSharedObject(sharingIndex, result);

        ReadTable rtable = ReadTable.getCurrent();
        Pair head = new Pair(null, LList.Empty);
        Pair last = head;
 for (;;)
   {
     int ch = lexer.read();
     if (ch < 0)
       lexer.eofError("unexpected EOF in vector starting here",
		      startLine + 1, startColumn);
     if (ch == close)
       break;
            last = lexer.readValuesAndAppend(ch, rtable, last);
   }
        result.replaceAll(((LList) head.getCdr()).toArray());
        result.setReadOnly();
 return result;

      }
    finally
      {
 if (port instanceof InPort)
   ((InPort) port).readState = saveReadState;
      }
 }
 
开发者ID:spurious,项目名称:kawa-mirror,代码行数:41,代码来源:ReaderVector.java


示例13: setMenuBar

import gnu.lists.LList; //导入依赖的package包/类
public void setMenuBar (LList list)
{
  if (menubar != null)
  {
    SwtHelper.dispose(menubar);
  }

  menubar = SwtHelper.newMenu(shell, SWT.BAR );
  setMenuHelper(menubar, list);
  SwtHelper.setMenuBar(shell, menubar);
}
 
开发者ID:spurious,项目名称:kawa-mirror,代码行数:12,代码来源:SwtFrame.java


示例14: setMenuHelper

import gnu.lists.LList; //导入依赖的package包/类
/**
 * Heavily inspired from gnu.jemacs.swing.SwingMenu
 */
private void setMenuHelper(Menu parent, LList list)
{
  
  for (Iterator iter = list.iterator(); iter.hasNext();)
  {
    Object o = iter.next();
    try
    {
      if (o == null) 
      {
        continue;
      }
      else if (o instanceof Pair)
      {
        CharSequence menuName = (CharSequence) ((Pair) o).getCar();
        MenuItem menuItem = SwtHelper.newMenuItem(parent, SWT.CASCADE, menuName.toString(), null);
        Menu subMenu = SwtHelper.newMenu(menuItem);
        setMenuHelper(subMenu, (LList) ((Pair) o).getCdr());
        SwtHelper.setMenu(menuItem, subMenu);
      }
      else if (o instanceof FVector) 
      {
        CharSequence menuItemName = (CharSequence) ((FVector) o).get(0);
        Object command = ((FVector) o).get(1);
        SwtHelper.newMenuItem(parent, SWT.DROP_DOWN, menuItemName.toString(), new MenuCommandHandler(command));
      }
      else if (o instanceof CharSequence) 
      {
       SwtHelper.newMenuItem(parent, SWT.SEPARATOR, null, null); 
      }
    }
    catch (Exception e) 
    {
      System.err.println("SwtFrame.setMenu - problem with " + o);
    }
  }
}
 
开发者ID:spurious,项目名称:kawa-mirror,代码行数:41,代码来源:SwtFrame.java


示例15: setMenuBar

import gnu.lists.LList; //导入依赖的package包/类
public void setMenuBar (LList menu)
 {
   menuBar.removeAll();
   java.util.Enumeration e = menu.elements();
   for (int i = 0;  e.hasMoreElements(); i++)
     {
Object item = e.nextElement();
       if (item == null)
         menuBar.add(Box.createHorizontalGlue());
       else
         menuBar.add(new SwingMenu((LList) item));
     }
   menuBar.updateUI();
 }
 
开发者ID:spurious,项目名称:kawa-mirror,代码行数:15,代码来源:SwingFrame.java


示例16: readVector

import gnu.lists.LList; //导入依赖的package包/类
public static FVector readVector(LispReader lexer, InPort port, int count, char close, int sharingIndex)
   throws java.io.IOException, SyntaxException
 {
   char saveReadState = ' ';
   if (port instanceof InPort)
     {	
saveReadState = ((InPort) port).readState;
((InPort) port).readState = close == ']' ? '[' : '(';
     }
   int startLine = port.getLineNumber();
   int startColumn = port.getColumnNumber()-1;
    try
      {
        ConstVector result = new ConstVector();
        lexer.bindSharedObject(sharingIndex, result);

        ReadTable rtable = ReadTable.getCurrent();
        Pair head = new Pair(null, LList.Empty);
        Pair last = head;
 for (;;)
   {
     int ch = lexer.read();
     if (ch < 0)
       lexer.eofError("unexpected EOF in vector starting here",
		      startLine + 1, startColumn);
     if (ch == close)
       break;
            last = lexer.readValuesAndAppend(ch, rtable, last);
   }
        result.setDataBackDoor(((LList) head.getCdr()).toArray());
 return result;

      }
    finally
      {
 if (port instanceof InPort)
   ((InPort) port).readState = saveReadState;
      }
 }
 
开发者ID:maoueh,项目名称:kawa-fork,代码行数:40,代码来源:ReaderVector.java


示例17: setMenuBar

import gnu.lists.LList; //导入依赖的package包/类
/**
 * @see gnu.jemacs.buffer.EFrame#setMenu(gnu.lists.LList)
 */
public void setMenuBar (LList list)
{
  if (menubar != null)
  {
    SwtHelper.dispose(menubar);
  }

  menubar = SwtHelper.newMenu(shell, SWT.BAR );
  setMenuHelper(menubar, list);
  SwtHelper.setMenuBar(shell, menubar);
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:15,代码来源:SwtFrame.java


示例18: setMenuHelper

import gnu.lists.LList; //导入依赖的package包/类
/**
 * Heavily inspired from gnu.jemacs.swing.SwingMenu
 */
private void setMenuHelper(Menu parent, LList list)
{
  
  for (Iterator iter = list.iterator(); iter.hasNext();)
  {
    Object o = iter.next();
    try
    {
      if (o == null) 
      {
        continue;
      }
      else if (o instanceof Pair)
      {
        CharSequence menuName = (CharSequence) ((Pair) o).car;
        MenuItem menuItem = SwtHelper.newMenuItem(parent, SWT.CASCADE, menuName.toString(), null);
        Menu subMenu = SwtHelper.newMenu(menuItem);
        setMenuHelper(subMenu, (LList) ((Pair) o).cdr);
        SwtHelper.setMenu(menuItem, subMenu);
      }
      else if (o instanceof FVector) 
      {
        CharSequence menuItemName = (CharSequence) ((FVector) o).get(0);
        Object command = ((FVector) o).get(1);
        SwtHelper.newMenuItem(parent, SWT.DROP_DOWN, menuItemName.toString(), new MenuCommandHandler(command));
      }
      else if (o instanceof CharSequence) 
      {
       SwtHelper.newMenuItem(parent, SWT.SEPARATOR, null, null); 
      }
    }
    catch (Exception e) 
    {
      System.err.println("SwtFrame.setMenu - problem with " + o);
    }
  }
}
 
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:41,代码来源:SwtFrame.java


示例19: readVector

import gnu.lists.LList; //导入依赖的package包/类
public static FVector readVector(LispReader lexer, LineBufferedReader port, int count, char close, int sharingIndex)
   throws java.io.IOException, SyntaxException
 {
   char saveReadState = ' ';
   if (port instanceof InPort)
     {	
saveReadState = ((InPort) port).readState;
((InPort) port).readState = close == ']' ? '[' : '(';
     }
   int startLine = port.getLineNumber();
   int startColumn = port.getColumnNumber()-1;
    try
      {
        ConstVector result = new ConstVector();
        lexer.bindSharedObject(sharingIndex, result);

        ReadTable rtable = ReadTable.getCurrent();
        Pair head = new Pair(null, LList.Empty);
        Pair last = head;
 for (;;)
   {
     int ch = lexer.read();
     if (ch < 0)
       lexer.eofError("unexpected EOF in vector starting here",
		      startLine + 1, startColumn);
     if (ch == close)
       break;
            last = lexer.readValuesAndAppend(ch, rtable, last);
   }
        result.setDataBackDoor(((LList) head.getCdr()).toArray());
 return result;

      }
    finally
      {
 if (port instanceof InPort)
   ((InPort) port).readState = saveReadState;
      }
 }
 
开发者ID:alain91,项目名称:kawa,代码行数:40,代码来源:ReaderVector.java


示例20: toString

import gnu.lists.LList; //导入依赖的package包/类
public static String toString(Object value) {
	if (value instanceof LList) {
		return listToString((LList) value);
	} else {
		return value.toString();
	}
}
 
开发者ID:MAGCruise,项目名称:magcruise-broker,代码行数:8,代码来源:ConvertUtils.java



注:本文中的gnu.lists.LList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextFieldInplaceEditor类代码示例发布时间:2022-05-23
下一篇:
Java CEnumConstant类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap