当前位置: 首页>>代码示例>>Java>>正文


Java TimeLimitExceededException类代码示例

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


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

示例1: findSolution

import javax.naming.TimeLimitExceededException; //导入依赖的package包/类
/**
 * Finds the path from the current state to a state where the goal is
 * fulfilled.
 * 
 * @param goal
 *            The goal to be fulfilled
 * @return a Plan of how to solve the current problem
 */
public Plan findSolution(CompositeGoal goal)
		throws TimeLimitExceededException {
	// TODO Auto-generated method stub
	Plan plan = new Plan();

	int column = 0;
	while (((JSONArray) world.get(column)).isEmpty())
		column++;

	plan.add("I pick up . . .");
	plan.add("pick " + column);
	plan.add(". . . and then I drop down");
	plan.add("drop " + column);

	return plan;
}
 
开发者ID:Chefenmike,项目名称:AI,代码行数:25,代码来源:Planner.java

示例2: test_getExceptionFromResult

import javax.naming.TimeLimitExceededException; //导入依赖的package包/类
public void test_getExceptionFromResult() {
    String message = "error message";
    LdapResult result = getLdapResult(0, message);
    NamingException ex = LdapUtils.getExceptionFromResult(result);
    assertNull(ex);

    // error code map to CommunicationException
    result = getLdapResult(2, message);
    ex = LdapUtils.getExceptionFromResult(result);
    assertTrue(ex instanceof CommunicationException);
    assertEquals("[LDAP: error code 2 - error message]", ex.getMessage());

    // error code not in map
    result = getLdapResult(100, message);
    ex = LdapUtils.getExceptionFromResult(result);
    assertTrue(ex instanceof NamingException);
    assertEquals("[LDAP: error code 100 - error message]", ex.getMessage());

    // empty error message
    result = getLdapResult(3, "");
    ex = LdapUtils.getExceptionFromResult(result);
    assertTrue(ex instanceof TimeLimitExceededException);
    assertEquals("[LDAP: error code 3]", ex.getMessage());
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:LdapUtilsTest.java

示例3: parseAndplan

import javax.naming.TimeLimitExceededException; //导入依赖的package包/类
private static void parseAndplan() throws TimeLimitExceededException {
	List tstrs = new ArrayList();
	result.put("trees", tstrs);
	for (Term t : trees) {
		tstrs.add(t.toString());
	}

	if (trees.isEmpty()) {
		result.put("output", "Parse error!");

	} else {
		List<CompositeGoal> goals = new ArrayList<CompositeGoal>();
		Interpreter interpreter = new Interpreter(currentWorld);
		for (Term tree : trees) {
			try {
				goals.addAll(interpreter.interpret(tree));
			} catch (PlanningException e) {
				//TODO: message gets overwritten later
				result.put("output", e.getMessage());
			}
		}
		String goalString = goals.toString();
		result.put("goals", goalString);

		if (goals.isEmpty()) {
			result.put("output", "Interpretation error!");

		} else if (goals.size() > 1) {
			result.put("output", "Ambiguity error!");

		} else {
			Planner planner = new BreadthFirstPlanner(currentWorld);
			Plan plan = planner.findSolution(goals.get(0));
			result.put("plan", plan.getPlan());

			if (plan.getPlan().isEmpty()) {
				result.put("output", "Goal is alreay fulfilled!");
			} else {
				result.put("output", "Success!");
				currentWorld = plan.getWorld();
			}
		}
	}
}
 
开发者ID:Chefenmike,项目名称:AI,代码行数:45,代码来源:Shrdlite.java


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