java.lang.System Java Examples
The following examples show how to use
java.lang.System.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CursorStim.java From buffer_bci with GNU General Public License v3.0 | 7 votes |
public void display(){ JFrame frame = new JFrame("Cursor Stim"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Cursor Stim"); frame.getContentPane().add(this, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); // start the experiment controller thread startControllerThread(); // run the main-loop rendering loop renderloop(); // run the experiment frame.dispose(); System.exit(0); }
Example #2
Source File: DefaultValue.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { boolean endResult = true; if (!arePaddedPairwise(R1.class, "int1", "int2")) { System.err.println("R1 failed"); endResult &= false; } if (!arePaddedPairwise(R2.class, "int1", "int2")) { System.err.println("R2 failed"); endResult &= false; } if (!arePaddedPairwise(R3.class, "int1", "int2")) { System.err.println("R3 failed"); endResult &= false; } System.out.println(endResult ? "Test PASSES" : "Test FAILS"); if (!endResult) { throw new Error("Test failed"); } }
Example #3
Source File: DefaultValue.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { boolean endResult = true; if (!arePaddedPairwise(R1.class, "int1", "int2")) { System.err.println("R1 failed"); endResult &= false; } if (!arePaddedPairwise(R2.class, "int1", "int2")) { System.err.println("R2 failed"); endResult &= false; } if (!arePaddedPairwise(R3.class, "int1", "int2")) { System.err.println("R3 failed"); endResult &= false; } System.out.println(endResult ? "Test PASSES" : "Test FAILS"); if (!endResult) { throw new Error("Test failed"); } }
Example #4
Source File: TypeSpecTest.java From javapoet with Apache License 2.0 | 6 votes |
@Test public void indexedElseIf() throws Exception { TypeSpec taco = TypeSpec.classBuilder("Taco") .addMethod(MethodSpec.methodBuilder("choices") .beginControlFlow("if ($1L != null || $1L == $2L)", "taco", "otherTaco") .addStatement("$T.out.println($S)", System.class, "only one taco? NOO!") .nextControlFlow("else if ($1L.$3L && $2L.$3L)", "taco", "otherTaco", "isSupreme()") .addStatement("$T.out.println($S)", System.class, "taco heaven") .endControlFlow() .build()) .build(); assertThat(toString(taco)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "import java.lang.System;\n" + "\n" + "class Taco {\n" + " void choices() {\n" + " if (taco != null || taco == otherTaco) {\n" + " System.out.println(\"only one taco? NOO!\");\n" + " } else if (taco.isSupreme() && otherTaco.isSupreme()) {\n" + " System.out.println(\"taco heaven\");\n" + " }\n" + " }\n" + "}\n"); }
Example #5
Source File: LayoutFrame.java From java-example with MIT License | 6 votes |
private void setHasFrame(JFrame frame, boolean hasFrame) { if (!this.frameless) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { System.out.println(windowName + " hasFrame=" + hasFrame); WinDef.HWND hWnd = new WinDef.HWND(); hWnd.setPointer(Native.getComponentPointer(frame)); LayoutFrame.this.externalWindowObserver.setHasFrame(hWnd, hasFrame); frame.setResizable(hasFrame); frame.invalidate(); frame.validate(); frame.repaint(); SwingUtilities.updateComponentTreeUI(frame); } }); } }
Example #6
Source File: Main.java From Rholang with MIT License | 6 votes |
/*************************************************************** Function: pset **************************************************************/ private void pset ( Vector dtrans_group ) { int i; int size; CDTrans dtrans; size = dtrans_group.size(); for (i = 0; i < size; ++i) { dtrans = (CDTrans) dtrans_group.elementAt(i); System.out.print(dtrans.m_label + " "); } }
Example #7
Source File: PropertyListWriter.java From JarBundler with Apache License 2.0 | 6 votes |
private void writeJavaProperties(Hashtable javaProperties, Node appendTo) { writeKey("Properties", appendTo); Node propertiesDict = createNode("dict", appendTo); for (Iterator i = javaProperties.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); if (key.startsWith("com.apple.") && (bundleProperties.getJavaVersion() >= 1.4)) { System.out.println("Deprecated as of 1.4: " + key); continue; } writeKeyStringPair(key, (String) javaProperties.get(key), propertiesDict); } }
Example #8
Source File: TypeSpecTest.java From javapoet with Apache License 2.0 | 6 votes |
@Test public void elseIf() throws Exception { TypeSpec taco = TypeSpec.classBuilder("Taco") .addMethod(MethodSpec.methodBuilder("choices") .beginControlFlow("if (5 < 4) ") .addStatement("$T.out.println($S)", System.class, "wat") .nextControlFlow("else if (5 < 6)") .addStatement("$T.out.println($S)", System.class, "hello") .endControlFlow() .build()) .build(); assertThat(toString(taco)).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "import java.lang.System;\n" + "\n" + "class Taco {\n" + " void choices() {\n" + " if (5 < 4) {\n" + " System.out.println(\"wat\");\n" + " } else if (5 < 6) {\n" + " System.out.println(\"hello\");\n" + " }\n" + " }\n" + "}\n"); }
Example #9
Source File: Pattern.java From AliceBot with Apache License 2.0 | 5 votes |
public void appendChild(AIMLElement child) { String text = child.toString(); if (pattern == null) pattern = new String[] {text}; else { int length = pattern.length; String[] larger = new String[length + 1]; System.arraycopy(pattern, 0, larger, 0, length); larger[length] = text; pattern = larger; } }
Example #10
Source File: TestDynamicPolicy.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) throws Exception { try { // TestDynamicPolicy jstest = new TestDynamicPolicy(); jstest.doit(); } catch(Exception e) { System.out.println("Failed. Unexpected exception:" + e); throw e; } System.out.println("Passed. OKAY"); }
Example #11
Source File: StreamZipEntriesTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Test public void testStreamZip() throws IOException { try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) { zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry)); zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java")); Object elements[] = zf.stream().toArray(); assertEquals(1, elements.length); assertEquals(elements[0].toString(), "ReadZip.java"); } }
Example #12
Source File: ArrayListCursor.java From Silence with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings({"unchecked"}) public ArrayListCursor(String[] columnNames, ArrayList<ArrayList> rows) { int colCount = columnNames.length; boolean foundID = false; // Add an _id column if not in columnNames for (String columnName : columnNames) { if (columnName.compareToIgnoreCase("_id") == 0) { mColumnNames = columnNames; foundID = true; break; } } if (!foundID) { mColumnNames = new String[colCount + 1]; System.arraycopy(columnNames, 0, mColumnNames, 0, columnNames.length); mColumnNames[colCount] = "_id"; } int rowCount = rows.size(); mRows = new ArrayList[rowCount]; for (int i = 0; i < rowCount; ++i) { mRows[i] = rows.get(i); if (!foundID) { mRows[i].add(i); } } }
Example #13
Source File: StreamZipEntriesTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test public void testStreamJar() throws IOException { try (JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"))) { jf.stream().forEach(e -> assertTrue(e instanceof JarEntry)); Object elements[] = jf.stream().toArray(); assertEquals(3, elements.length); assertEquals(elements[0].toString(), "META-INF/"); assertEquals(elements[1].toString(), "META-INF/MANIFEST.MF"); assertEquals(elements[2].toString(), "ReleaseInflater.java"); } }
Example #14
Source File: TestDynamicPolicy.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private String getUserName() { String usr = null; try { usr = System.getProperty("user.name"); } catch (Exception e) { } return usr; }
Example #15
Source File: StreamZipEntriesTest.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test public void testStreamJar() throws IOException { try (JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"))) { jf.stream().forEach(e -> assertTrue(e instanceof JarEntry)); Object elements[] = jf.stream().toArray(); assertEquals(3, elements.length); assertEquals(elements[0].toString(), "META-INF/"); assertEquals(elements[1].toString(), "META-INF/MANIFEST.MF"); assertEquals(elements[2].toString(), "ReleaseInflater.java"); } }
Example #16
Source File: StreamZipEntriesTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test public void testStreamJar() throws IOException { try (JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar"))) { jf.stream().forEach(e -> assertTrue(e instanceof JarEntry)); Object elements[] = jf.stream().toArray(); assertEquals(3, elements.length); assertEquals(elements[0].toString(), "META-INF/"); assertEquals(elements[1].toString(), "META-INF/MANIFEST.MF"); assertEquals(elements[2].toString(), "ReleaseInflater.java"); } }
Example #17
Source File: TestDynamicPolicy.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private String getUserName() { String usr = null; try { usr = System.getProperty("user.name"); } catch (Exception e) { } return usr; }
Example #18
Source File: StreamZipEntriesTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test public void testStreamZip() throws IOException { try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) { zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry)); zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java")); Object elements[] = zf.stream().toArray(); assertEquals(1, elements.length); assertEquals(elements[0].toString(), "ReadZip.java"); } }
Example #19
Source File: TestDynamicPolicy.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) throws Exception { try { // TestDynamicPolicy jstest = new TestDynamicPolicy(); jstest.doit(); } catch(Exception e) { System.out.println("Failed. Unexpected exception:" + e); throw e; } System.out.println("Passed. OKAY"); }
Example #20
Source File: TestDynamicPolicy.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private String getUserName() { String usr = null; try { usr = System.getProperty("user.name"); } catch (Exception e) { } return usr; }
Example #21
Source File: StreamZipEntriesTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Test public void testStreamZip() throws IOException { try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) { zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry)); zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java")); Object elements[] = zf.stream().toArray(); assertEquals(1, elements.length); assertEquals(elements[0].toString(), "ReadZip.java"); } }
Example #22
Source File: JarBundler.java From JarBundler with Apache License 2.0 | 5 votes |
private void processCopyingFileSets(List fileSets, File targetdir, boolean setExec) { for (Iterator execIter = fileSets.iterator(); execIter.hasNext();) { FileSet fs = (FileSet) execIter.next(); Project p = fs.getProject(); File srcDir = fs.getDir(p); FileScanner ds = fs.getDirectoryScanner(p); fs.setupDirectoryScanner(ds, p); ds.scan(); String[] files = ds.getIncludedFiles(); if (files.length == 0) { // this is probably an error -- warn about it System.err .println("WARNING: fileset for copying from directory " + srcDir + ": no files found"); } else { try { for (int i = 0; i < files.length; i++) { String fileName = files[i]; File src = new File(srcDir, fileName); File dest = new File(targetdir, fileName); if (mVerbose) log("Copying " + (setExec ? "exec" : "resource") + " file to \"" + bundlePath(dest) +"\""); mFileUtils.copyFile(src, dest); if (setExec) setExecutable(dest); } } catch (IOException ex) { throw new BuildException("Cannot copy file: " + ex); } } } }
Example #23
Source File: JavaFileTest.java From javapoet with Apache License 2.0 | 5 votes |
@Test public void importStaticMixed() { JavaFile source = JavaFile.builder("com.squareup.tacos", TypeSpec.classBuilder("Taco") .addStaticBlock(CodeBlock.builder() .addStatement("assert $1T.valueOf(\"BLOCKED\") == $1T.BLOCKED", Thread.State.class) .addStatement("$T.gc()", System.class) .addStatement("$1T.out.println($1T.nanoTime())", System.class) .build()) .addMethod(MethodSpec.constructorBuilder() .addParameter(Thread.State[].class, "states") .varargs(true) .build()) .build()) .addStaticImport(Thread.State.BLOCKED) .addStaticImport(System.class, "*") .addStaticImport(Thread.State.class, "valueOf") .build(); assertThat(source.toString()).isEqualTo("" + "package com.squareup.tacos;\n" + "\n" + "import static java.lang.System.*;\n" + "import static java.lang.Thread.State.BLOCKED;\n" + "import static java.lang.Thread.State.valueOf;\n" + "\n" + "import java.lang.Thread;\n" + "\n" + "class Taco {\n" + " static {\n" + " assert valueOf(\"BLOCKED\") == BLOCKED;\n" + " gc();\n" + " out.println(nanoTime());\n" + " }\n" + "\n" + " Taco(Thread.State... states) {\n" + " }\n" + "}\n"); }
Example #24
Source File: Main.java From Rholang with MIT License | 5 votes |
/*************************************************************** Function: in_dstates **************************************************************/ private int in_dstates ( CBunch bunch ) { CDfa dfa; if (CUtility.OLD_DEBUG) { System.out.print("Looking for set : "); m_lexGen.print_set(bunch.m_nfa_set); } dfa = (CDfa) m_spec.m_dfa_sets.get(bunch.m_nfa_bit); if (null != dfa) { if (CUtility.OLD_DUMP_DEBUG) { System.out.println(" FOUND!"); } return dfa.m_label; } if (CUtility.OLD_DUMP_DEBUG) { System.out.println(" NOT FOUND!"); } return NOT_IN_DSTATES; }
Example #25
Source File: LayoutFrame.java From java-example with MIT License | 5 votes |
public void cleanup() { try { System.out.println(windowName + " cleaning up "); this.externalWindowObserver.dispose(); } catch (Exception e) { e.printStackTrace(); } }
Example #26
Source File: PostTest.java From dev-summit-architecture-demo with Apache License 2.0 | 5 votes |
@Test(expected = ValidationFailedException.class) public void emptyCustomId() { Post post = new Post(); post.setUserId(1); post.setClientId(null); post.setText("abc"); post.setCreated(System.currentTimeMillis()); post.validate(); }
Example #27
Source File: StreamZipEntriesTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test public void testStreamZip() throws IOException { try (ZipFile zf = new ZipFile(new File(System.getProperty("test.src", "."), "input.zip"))) { zf.stream().forEach(e -> assertTrue(e instanceof ZipEntry)); zf.stream().forEach(e -> assertEquals(e.toString(), "ReadZip.java")); Object elements[] = zf.stream().toArray(); assertEquals(1, elements.length); assertEquals(elements[0].toString(), "ReadZip.java"); } }
Example #28
Source File: StreamZipEntriesTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test public void testClosedJarFile() throws IOException { JarFile jf = new JarFile(new File(System.getProperty("test.src", "."), "input.jar")); jf.close(); try { Stream s = jf.stream(); fail("Should have thrown IllegalStateException"); } catch (IllegalStateException e) { // expected; } }
Example #29
Source File: EarlyTimeout.java From hottub with GNU General Public License v2.0 | 5 votes |
public void run() { try { startedSignal.countDown(); long start = System.nanoTime(); reference = queue.remove(TIMEOUT); actual = NANOSECONDS.toMillis(System.nanoTime() - start); } catch (InterruptedException ex) { throw new RuntimeException(ex); } }
Example #30
Source File: ArrayListCursor.java From bcm-android with GNU General Public License v3.0 | 5 votes |
@SuppressWarnings({"unchecked"}) public ArrayListCursor(String[] columnNames, ArrayList<ArrayList> rows) { int colCount = columnNames.length; boolean foundID = false; // Add an _id column if not in columnNames for (int i = 0; i < colCount; ++i) { if (columnNames[i].compareToIgnoreCase("_id") == 0) { mColumnNames = columnNames; foundID = true; break; } } if (!foundID) { mColumnNames = new String[colCount + 1]; System.arraycopy(columnNames, 0, mColumnNames, 0, columnNames.length); mColumnNames[colCount] = "_id"; } int rowCount = rows.size(); mRows = new ArrayList[rowCount]; for (int i = 0; i < rowCount; ++i) { mRows[i] = rows.get(i); if (!foundID) { mRows[i].add(i); } } }