我想创建一个"架构图"来解释我们的软件(库,Eclipse RCP,模块,功能等).
在游戏2048中,假设玩家在最佳位置进行最佳播放并平铺产卵,那么可以实现的最大平铺是什么?
天真的我会说最大可实现的瓷砖是65536 * 2 = 131072因为看起来最好的电路板如下:
4 4 8 16
256 128 64 32
512 1024 2048 4096
65536 32768 16384 8192
Run Code Online (Sandbox Code Playgroud)
但我不确定是否
(对不起,如果我应该问game.stackexchange,但这更像是一个CS问题,而不是游戏中的一个)
这些是我的测试用例
class Mother {
@Before
public void setUp() {
if (!this.getClass().isAnnotatedWith("Version20")) { // pseudo code
/*
* stop this test without failing!
*/
}
// further setup
}
}
@Version20
class Child extends Mother {
@Test
public void test() {
// run only when Version == 20
}
}
Run Code Online (Sandbox Code Playgroud)
是否可以在母亲的@Before方法中停止测试而不会失败或断言(假)?
编辑:我有更多版本@ Version19,@ Version18等我的软件正在读取配置文件并输出结果某些测试仅适用于特殊版本.我不想在测试方法中进行版本检查,因为我有很多小测试,不喜欢代码重复
我有一个简单的Eclipse插件,它让我在激活时出现以下错误:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://103.fwk8918249:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://103.fwk8918249:4/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Run Code Online (Sandbox Code Playgroud)
两个URL都解析为捆绑中完全相同的jar
libs/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class
Run Code Online (Sandbox Code Playgroud)
我想创建一个可以从控制台启动的无头 Eclipse RCP 应用程序。目前我在 .ini 文件中使用这个参数:
-控制台日志
问题是这会打开一个我不想要的额外 OSGI 控制台。有没有办法抑制控制台并在原始终端中获取输出?
项目设置:
从SomeBundle访问Logger类可以正常工作,但是日志记录项目找不到log4j.properties(log4j:WARN没有为logger找到appender).
问题:
也许我在文档中错过了它,但我想知道我应该如何处理"帮助对象"?
代码示例:
public Path dijkstra(Node startNode, Node endNode) {
Set<Node> nodesToInspect = new HashSet<Node>(); // should this Object be injected?
Path path = new Path(); // and this one?
while (!nodesToInspect.isEmpty()) {
// some logic like:
path.add(currentNode);
}
return path;
}
Run Code Online (Sandbox Code Playgroud)
我应该注入一切还是应该在某种程度上说算法"最了解"它需要什么?我应该尝试消除每一个"新"吗?或者是一些对象创建很好,例如像HashSet,ArrayList等API类.
我试图完全理解该方法的工作原理,请参阅下面的代码:
public static void main(String[] args) {
System.out.println(countspaces("a number of spaces "));
}
public static int countspaces(String s) {
if (s.length() == 0)
return 0;
else
return (s.charAt(0) == ' ' ? 1 : 0) + countspaces(s.substring(1));
}
Run Code Online (Sandbox Code Playgroud)
我使用BlueJ调试了该方法.这条线:
return (s.charAt(0) == ' ' ? 1 : 0) + countspaces(s.substring(1));
Run Code Online (Sandbox Code Playgroud)
首先检查索引零处的字符是否为空格,然后再次调用自身(这使得它递归)从索引1开始的s的子字符串作为参数有效地将参数从"多个空格"更改为"空格的数量"直到参数的长度()达到0为止.我没有得到的是为什么它不返回01000000100100000010(最后的0是空字符串s终止循环)但是4?我无法看到代码中的哪个位置总结了1的返回值
(s.charAt(0) == ' ' ? 1 : 0)
Run Code Online (Sandbox Code Playgroud)
并忽略了0.请告诉我我的推理缺少什么.
非常感谢
格热戈日(格雷格)
我有一个参数化作业,它有一个名称、一个 SVN 存储库和一个共享目录。我需要使用大约 20 组这些参数定期调用此作业。目前我刚刚创建了 20 个工作,每个工作都称为主工作。
这是一个非常繁琐的配置,并且会弄乱 Jenkins 中的主视图。
有没有更好的可能性来解决这个问题?我愿意重组工作或使用插件来“隐藏”它们。
有关工作的更多详细信息:我实际上有两种主要工作:
我需要/想要什么:
我正在编写一个程序,它将提供用户提供的姓名首字母(字符串)作为输入。我想使用Space functionwhile 编写名称作为算法的基础。例如:
<Firstname><space><Lastname>
Run Code Online (Sandbox Code Playgroud)
在 for 循环中取一次字符并检查它们之间是否有空格,如果有,它将打印之前的字符。有人能告诉我如何实现这个吗?我正在尝试此操作,但出现一个错误。
任何帮助都非常感谢.. PS-我是 Java 新手,发现它很有趣。对不起,如果编码中有一个大错误
public class Initials {
public static void main(String[] args) {
String name = new String();
System.out.println("Enter your name: ");
Scanner input = new Scanner(System.in);
name = input.nextLine();
System.out.println("You entered : " + name);
String temp = new String(name.toUpperCase());
System.out.println(temp);
char c = name.charAt(0);
System.out.println(c);
for (int i = 1; i < name.length(); i++) {
char c = name.charAt(i);
if (c == '') {
System.out.println(name.charAt(i - 1));
} …Run Code Online (Sandbox Code Playgroud) 我在“u01/jenkins/.m2/”中有我的 settings.xml 文件。这是我必须为 nexus 部署配置的地方吗?请指教
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jenktest: Failed to deploy artifacts: Could not transfer artifact tulsa.jenkins.test:jenktest:pom:0.0.1-20170905.090435-1 from/to snapshots (http://myhost:8081/nexus/content/repositories/snapshots): Failed to transfer file: http://myhost:8081/nexus/content/repositories/snapshots/tulsa/jenkins/test/jenktest/0.0.1-SNAPSHOT/jenktest-0.0.1-20170905.090435-1.pom. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project jenktest: Failed to deploy artifacts: Could not transfer artifact tulsa.jenkins.test:jenktest:pom:0.0.1-20170905.090435-1 from/to snapshots (http://204.26.165.206:8081/nexus/content/repositories/snapshots): Failed to transfer file: http://myhost:8081/nexus/content/repositories/snapshots/tulsa/jenkins/test/jenktest/0.0.1-SNAPSHOT/jenktest-0.0.1-20170905.090435-1.pom. Return code is: 401, ReasonPhrase: Unauthorized.
Run Code Online (Sandbox Code Playgroud)