bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public float getLayoutAlignmentY(Container parent) { return(parent.getAlignmentY()); }
|
public float getLayoutAlignmentY(Container parent) { return 0.5F; }
| 3,807
|
public GeneralNames(final byte[] encoded) throws IOException { names = new LinkedList(); DERReader der = new DERReader(encoded); DERValue nameList = der.read(); if (!nameList.isConstructed()) throw new IOException("malformed GeneralNames"); int len = 0; while (len < nameList.getLength()) { DERValue name = der.read(); List namePair = new ArrayList(2); if (name.getTagClass() != DER.APPLICATION) throw new IOException("malformed GeneralName"); namePair.add(new Integer(name.getTag())); DERValue val = null; switch (name.getTag()) { case RFC822_NAME: case DNS_NAME: case X400_ADDRESS: case URI: namePair.add(new String((byte[]) name.getValue())); break; case OTHER_NAME: case EDI_PARTY_NAME: namePair.add(name.getValue()); break; case DIRECTORY_NAME: byte[] b = name.getEncoded(); b[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE); namePair.add(new X500DistinguishedName(b).toString()); break; case IP_ADDRESS: namePair.add(InetAddress.getByAddress((byte[]) name.getValue()) .getHostAddress()); break; case REGISTERED_ID: byte[] bb = name.getEncoded(); bb[0] = (byte) DER.OBJECT_IDENTIFIER; namePair.add(new OID(bb).toString()); break; default: throw new IOException("unknown tag " + name.getTag()); } names.add(namePair); len += name.getEncodedLength(); } }
|
public GeneralNames(final byte[] encoded) throws IOException { names = new LinkedList(); DERReader der = new DERReader(encoded); DERValue nameList = der.read(); if (!nameList.isConstructed()) throw new IOException("malformed GeneralNames"); int len = 0; while (len < nameList.getLength()) { DERValue name = der.read(); List namePair = new ArrayList(2); if (name.getTagClass() != DER.APPLICATION) throw new IOException("malformed GeneralName"); namePair.add(new Integer(name.getTag())); DERValue val = null; switch (name.getTag()) { case RFC822_NAME: case DNS_NAME: case X400_ADDRESS: case URI: namePair.add(new String((byte[]) name.getValue())); break; case OTHER_NAME: case EDI_PARTY_NAME: namePair.add(name.getValue()); break; case DIRECTORY_NAME: byte[] b = name.getEncoded(); b[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE); namePair.add(new X500DistinguishedName(b).toString()); break; case IP_ADDRESS: namePair.add(InetAddress.getByAddress((byte[]) name.getValue()) .getHostAddress()); break; case REGISTERED_ID: byte[] bb = name.getEncoded(); bb[0] = (byte) DER.OBJECT_IDENTIFIER; namePair.add(new OID(bb).toString()); break; default: throw new IOException("unknown tag " + name.getTag()); } names.add(namePair); len += name.getEncodedLength(); } }
| 3,809
|
public GeneralNames(final byte[] encoded) throws IOException { names = new LinkedList(); DERReader der = new DERReader(encoded); DERValue nameList = der.read(); if (!nameList.isConstructed()) throw new IOException("malformed GeneralNames"); int len = 0; while (len < nameList.getLength()) { DERValue name = der.read(); List namePair = new ArrayList(2); if (name.getTagClass() != DER.APPLICATION) throw new IOException("malformed GeneralName"); namePair.add(new Integer(name.getTag())); DERValue val = null; switch (name.getTag()) { case RFC822_NAME: case DNS_NAME: case X400_ADDRESS: case URI: namePair.add(new String((byte[]) name.getValue())); break; case OTHER_NAME: case EDI_PARTY_NAME: namePair.add(name.getValue()); break; case DIRECTORY_NAME: byte[] b = name.getEncoded(); b[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE); namePair.add(new X500DistinguishedName(b).toString()); break; case IP_ADDRESS: namePair.add(InetAddress.getByAddress((byte[]) name.getValue()) .getHostAddress()); break; case REGISTERED_ID: byte[] bb = name.getEncoded(); bb[0] = (byte) DER.OBJECT_IDENTIFIER; namePair.add(new OID(bb).toString()); break; default: throw new IOException("unknown tag " + name.getTag()); } names.add(namePair); len += name.getEncodedLength(); } }
|
public GeneralNames(final byte[] encoded) throws IOException { names = new LinkedList(); DERReader der = new DERReader(encoded); DERValue nameList = der.read(); if (!nameList.isConstructed()) throw new IOException("malformed GeneralNames"); int len = 0; while (len < nameList.getLength()) { DERValue name = der.read(); List namePair = new ArrayList(2); if (name.getTagClass() != DER.APPLICATION) throw new IOException("malformed GeneralName"); namePair.add(new Integer(name.getTag())); DERValue val = null; switch (name.getTag()) { case RFC822_NAME: case DNS_NAME: case X400_ADDRESS: case URI: namePair.add(new String((byte[]) name.getValue())); break; case OTHER_NAME: case EDI_PARTY_NAME: namePair.add(name.getValue()); break; case DIRECTORY_NAME: byte[] b = name.getEncoded(); b[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE); DERReader r = new DERReader (b); r.read (); namePair.add(new X500Principal(r.read ().getEncoded ()).toString()); break; case IP_ADDRESS: namePair.add(InetAddress.getByAddress((byte[]) name.getValue()) .getHostAddress()); break; case REGISTERED_ID: byte[] bb = name.getEncoded(); bb[0] = (byte) DER.OBJECT_IDENTIFIER; namePair.add(new OID(bb).toString()); break; default: throw new IOException("unknown tag " + name.getTag()); } names.add(namePair); len += name.getEncodedLength(); } }
| 3,810
|
public X500DistinguishedName(byte[] encoded) throws IOException { this(new ByteArrayInputStream(encoded)); }
|
public X500DistinguishedName(String name) { this(new ByteArrayInputStream(encoded)); }
| 3,811
|
public X500DistinguishedName(byte[] encoded) throws IOException { this(new ByteArrayInputStream(encoded)); }
|
public X500DistinguishedName(byte[] encoded) throws IOException { if (name == null) throw new NullPointerException(); try { parseDN(name, true); } catch (Exception e) { parseDN(name, false); } }
| 3,812
|
public void parseFields(byte[] cByte, ArrayList ffd, StringBuffer rb) { FileFieldDef f; // write out the html record information for each field that is selected for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { switch (f.getFieldType()) { case 'P': case 'S':// rb.append(f.parseData(cByte).trim() + delimiter); rb.append(getFixedLength(cByte,f)); break; default:// rb.append(stringQualifier + f.parseData(cByte).trim() + stringQualifier + delimiter);// rb.append(f.parseData(cByte)); rb.append(getFixedLength(cByte,f)); break; } } } rb.append ('\n'); fout.println(rb); }
|
public void parseFields(byte[] cByte, ArrayList ffd, StringBuffer rb) { FileFieldDef f; // write out the html record information for each field that is selected for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { switch (f.getFieldType()) { case 'P': case 'S':// rb.append(f.parseData(cByte).trim() + delimiter); rb.append(getFixedLength(cByte,f)); break; default:// rb.append(stringQualifier + f.parseData(cByte).trim() + stringQualifier + delimiter);// rb.append(f.parseData(cByte)); rb.append(getFixedLength(cByte,f)); break; } } } fout.println(rb); }
| 3,814
|
public void writeHeader(String fileName, String host, ArrayList ffd, char decChar) { try { FileFieldDef f; StringBuffer sb = new StringBuffer(); // loop through each of the fields and write out the field name for // each selected field for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { sb.append(f.getFieldName()); } } fout.write (sb.toString().getBytes()); fout.write ('\n'); } catch (IOException ioe) {// printFTPInfo(" error writing header " + ioe.getMessage()); } }
|
public void writeHeader(String fileName, String host, ArrayList ffd, char decChar) { try { FileFieldDef f; StringBuffer sb = new StringBuffer(); // loop through each of the fields and write out the field name for // each selected field for (int x = 0; x < ffd.size(); x++) { f = (FileFieldDef)ffd.get(x); if (f.isWriteField()) { sb.append(f.getFieldName()); } } fout.write (sb.toString().getBytes()); fout.write ('\n'); } catch (IOException ioe) {// printFTPInfo(" error writing header " + ioe.getMessage()); } }
| 3,815
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { JPanel modalInterceptor = new JPanel(); modalInterceptor.setOpaque(false); JLayeredPane lp = JLayeredPane.getLayeredPaneAbove(f); lp.setLayer(modalInterceptor, JLayeredPane.MODAL_LAYER.intValue()); modalInterceptor.setBounds(0, 0, lp.getWidth(), lp.getHeight()); modalInterceptor.addMouseListener(new MouseAdapter(){}); modalInterceptor.addMouseMotionListener(new MouseMotionAdapter(){}); lp.add(modalInterceptor); f.toFront(); EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue(); try { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,816
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,817
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { if (EventQueue.isDispatchThread()) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,818
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { AWTEvent ev = queue.getNextEvent(); if (ev instanceof ActiveEvent) ((ActiveEvent) ev).dispatch(); else if (ev.getSource() instanceof Component) ((Component) ev.getSource()).dispatchEvent(ev); else if (ev.getSource() instanceof MenuComponent) ((MenuComponent) ev.getSource()).dispatchEvent(ev); } else { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,819
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,820
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,821
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,822
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
|
private static void startModal(JInternalFrame f) { synchronized (f) { final JInternalFrame tmp = f; tmp.toFront(); f.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { synchronized (tmp) { tmp.removeInternalFrameListener(this); tmp.notifyAll(); } } }); try { while (! f.isClosed()) f.wait(); } catch (InterruptedException ignored) { // Ignore this Exception. } } }
| 3,823
|
public synchronized AWTEvent getNextEvent() throws InterruptedException { if (next != null) return next.getNextEvent(); while (next_in == next_out) wait(); AWTEvent res = queue[next_out]; if (++next_out == queue.length) next_out = 0; return res; }
|
public synchronized AWTEvent getNextEvent() throws InterruptedException { if (next != null) return next.getNextEvent(); while (next_in == next_out) wait(); AWTEvent res = queue[next_out]; if (++next_out == queue.length) next_out = 0; return res; }
| 3,824
|
public synchronized AWTEvent getNextEvent() throws InterruptedException { if (next != null) return next.getNextEvent(); while (next_in == next_out) wait(); AWTEvent res = queue[next_out]; if (++next_out == queue.length) next_out = 0; return res; }
|
public synchronized AWTEvent getNextEvent() throws InterruptedException { if (next != null) return next.getNextEvent(); while (next_in == next_out) wait(); if (!tk.nativeQueueEmpty() && (curr - lastNativeQueueAccess > humanLatencyThreshold)) { tk.iterateNativeQueue(this, false); lastNativeQueueAccess = curr; } if (++next_out == queue.length) next_out = 0; return res; }
| 3,825
|
public synchronized AWTEvent getNextEvent() throws InterruptedException { if (next != null) return next.getNextEvent(); while (next_in == next_out) wait(); AWTEvent res = queue[next_out]; if (++next_out == queue.length) next_out = 0; return res; }
|
public synchronized AWTEvent getNextEvent() throws InterruptedException { if (next != null) return next.getNextEvent(); while (next_in == next_out) wait(); AWTEvent res = queue[next_out]; if (++next_out == queue.length) next_out = 0; return res; }
| 3,826
|
public void dispatch();
|
void dispatch();
| 3,827
|
public final void dispatchEvent(AWTEvent event){ // See comment in Component.dispatchEvent(). dispatchEventImpl(event);}
|
public final void dispatchEvent(AWTEvent event){ Event oldStyleEvent = Component.translateEvent(event); if (oldStyleEvent != null) { postEvent(oldStyleEvent); } // See comment in Component.dispatchEvent(). dispatchEventImpl(event);}
| 3,828
|
public void removeUpdate(DocumentEvent ev) { Dimension size = textComponent.getSize(); rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height), BasicTextUI.this); int caretPos = textComponent.getCaretPosition(); if (caretPos >= ev.getOffset()) textComponent.setCaretPosition(caretPos - ev.getLength()); }
|
public void removeUpdate(DocumentEvent ev) { Dimension size = textComponent.getSize(); rootView.removeUpdate(ev, new Rectangle(0, 0, size.width, size.height), BasicTextUI.this); int caretPos = textComponent.getCaretPosition(); if (caretPos >= ev.getOffset()) textComponent.setCaretPosition(ev.getOffset()); }
| 3,829
|
static String not_applicable(String Id) { try { throw new MARSHAL("The read/write are not applicable for " + Id); } catch (Exception e) { throw new MARSHAL(); } }
|
static String not_applicable(String Id) { try { throw new MARSHAL("The read/write are not applicable for " + Id); } catch (Exception e) { throw new MARSHAL(); } }
| 3,831
|
public String complete(CommandLine partial) throws CompletionException { //System.out.println("completing \"" + partial + "\""); for (int i = 0; i < syntaxes.length; i++) { try { return syntaxes[i].complete(partial.getRemainder()); } catch (CompletionException ex) { // this syntax is not fitting // following debug output is for testing the "intelligent" delegation mechanism // System.err.println("Syntax \"" + syntaxes[i].getDescription() + "\" threw " // + ex.toString()); } } System.out.println(); usage(); throw new CompletionException("Invalid command syntax"); }
|
public String complete(CommandLine partial) throws CompletionException { //System.out.println("completing \"" + partial + "\""); for (int i = 0; i < syntaxes.length; i++) { try { return syntaxes[i].complete(partial.getRemainder()); } catch (CompletionException ex) { // this syntax is not fitting // following debug output is for testing the "intelligent" delegation mechanism // System.err.println("Syntax \"" + syntaxes[i].getDescription() + "\" threw " // + ex.toString()); } } System.out.println(); usage(); throw new CompletionException("Invalid command syntax"); }
| 3,832
|
public void help() { Help.getHelp().help(this); }
|
public void help() { Help.getHelp().help(this); }
| 3,833
|
public ParsedArguments parse(String[] args) throws SyntaxError { for (int i = 0; i < syntaxes.length; i++) { try { return syntaxes[i].parse(args); } catch (SyntaxError ex) { // debug output to debug syntax finding mechanism //System.err.println(ex.toString()); //ex.printStackTrace(System.out); } } // no fitting Syntax found? trow an error throw new SyntaxError("No matching syntax found"); }
|
public ParsedArguments parse(String[] args) throws SyntaxError { for (int i = 0; i < syntaxes.length; i++) { try { return syntaxes[i].parse(args); } catch (SyntaxError ex) { // debug output to debug syntax finding mechanism //System.err.println(ex.toString()); //ex.printStackTrace(System.out); } } // no fitting Syntax found? trow an error throw new SyntaxError("No matching syntax found"); }
| 3,834
|
public ParsedArguments parse(String[] args) throws SyntaxError { for (int i = 0; i < syntaxes.length; i++) { try { return syntaxes[i].parse(args); } catch (SyntaxError ex) { // debug output to debug syntax finding mechanism //System.err.println(ex.toString()); //ex.printStackTrace(System.out); } } // no fitting Syntax found? trow an error throw new SyntaxError("No matching syntax found"); }
|
public ParsedArguments parse(String[] args) throws SyntaxError { for (int i = 0; i < syntaxes.length; i++) { try { return syntaxes[i].parse(args); } catch (SyntaxError ex) { // debug output to debug syntax finding mechanism //System.err.println(ex.toString()); //ex.printStackTrace(System.out); } } // no fitting Syntax found? trow an error throw new SyntaxError("No matching syntax found"); }
| 3,835
|
public void usage() { Help.getHelp().usage(this); }
|
public void usage() { Help.getHelp().usage(this); }
| 3,836
|
public void keyPressed(KeyEvent e) { int kc = e.getKeyCode(); if (kc == KeyEvent.VK_N) { newGame(); return; } if (kc == KeyEvent.VK_P) { flipPause(); return; } if (!up || pause) return; switch (e.getKeyCode()) { case KeyEvent.VK_UP: rot(1); break; case KeyEvent.VK_LEFT: trans(-1); break; case KeyEvent.VK_DOWN: rot(3); break; case KeyEvent.VK_RIGHT: trans(1); break; case KeyEvent.VK_SPACE: fall(); break; case KeyEvent.VK_N: newGame(); break; case KeyEvent.VK_P: flipPause(); break; default: return; } repaint(); }
|
public void keyPressed(KeyEvent e) { int kc = e.getKeyCode(); if (kc == KeyEvent.VK_N) { newGame(); return; } if (kc == KeyEvent.VK_P) { flipPause(); return; } if (!isUp() || pause) return; switch (e.getKeyCode()) { case KeyEvent.VK_UP: rot(1); break; case KeyEvent.VK_LEFT: trans(-1); break; case KeyEvent.VK_DOWN: rot(3); break; case KeyEvent.VK_RIGHT: trans(1); break; case KeyEvent.VK_SPACE: fall(); break; case KeyEvent.VK_N: newGame(); break; case KeyEvent.VK_P: flipPause(); break; default: return; } repaint(); }
| 3,837
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
| 3,838
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
| 3,839
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (isUp()) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
| 3,840
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!isUp()) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
| 3,841
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
|
public void newGame() { if (thread != null) { setUp(false); if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { setUp(false); end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
| 3,842
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); thread.start(); }
|
public void newGame() { if (thread != null) { up = false; if (pause) { flipPause(); } try { thread.join(); } catch (InterruptedException ignore) { } } for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { if (i == 0 || j == 0 || i == WIDTH_C + 1 || j == HEIGHT_C + 1) WORLD[i][j] = COLORS.length - 1; else WORLD[i][j] = 0; } } requestFocus(); end = false; score = 0; si = si_rnd.nextInt(7); next_si = si_rnd.nextInt(7); bi = bi_rnd.nextInt(4); next_bi = bi_rnd.nextInt(4); x = 1 + bi_rnd.nextInt((WIDTH_C - DIMS[si * 4 + bi][0])); y = 0; thread = new Thread(new Runnable() { public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } } }); setUp(true); thread.start(); }
| 3,843
|
public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
|
public void run() { try { long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
| 3,844
|
public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
|
public void run() { try { up = true; long before, after, sleep; stop: while (isUp()) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
| 3,845
|
public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
|
public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!isUp()) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
| 3,846
|
public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { up = false; end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
|
public void run() { try { up = true; long before, after, sleep; stop: while (up) { before = System.currentTimeMillis(); synchronized (Tetris.class) { while (pause) { try { System.out.println("waiting"); Tetris.class.wait(); System.out.println("back from waiting"); } catch (InterruptedException ignore) { } if (!up) break stop; } } if (hasRoom(bi, x, y + 1)) { y++; repaint(); } else { newBlock(); if (!hasRoom(bi, x, y)) { setUp(false); end = true; repaint(); } } after = System.currentTimeMillis(); sleep = delay - (after - before); sleep = sleep < 0 ? delay : sleep; try { Thread.sleep(sleep); } catch (InterruptedException ignore) { } } } catch (Throwable ex) { ex.printStackTrace(); } }
| 3,847
|
public void paint(Graphics g) { if (img == null) { img = createImage(DIM.width, DIM.height); } Graphics g2 = img.getGraphics(); g2.setColor(COLORS[0]); g2.fillRect(0, 0, DIM.width, DIM.height); for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { int ci = WORLD[i][j]; if (ci > 0) paintBox(g2, i, j, COLORS[ci]); } } { Color c = COLORS[COLORS.length - 1]; for (int i = 0; i < WIDTH_C + 2; i++) { paintBox(g2, i, HEIGHT_C + 6, c); } for (int j = 0; j < 4; j++) { paintBox(g2, 0, HEIGHT_C + 2 + j, c); paintBox(g2, 5, HEIGHT_C + 2 + j, c); // paintBox(g2, 6, HEIGHT_C + 2 +j, c ); paintBox(g2, WIDTH_C + 1, HEIGHT_C + 2 + j, c); } } if (up) { int[][] b = BLOCKS[si][bi]; for (int i = 0; i < b.length; i++) { paintBox(g2, x + b[i][0], y + b[i][1], COLORS[si + 1]); } { g2.setColor(Color.WHITE); g2.drawString("SCORE:", CELL + 2, (HEIGHT_C + 4) * CELL - 4); g2.drawString(String.valueOf(score), 2 * CELL, (HEIGHT_C + 5) * CELL - 4); b = BLOCKS[next_si][next_bi]; for (int i = 0; i < b.length; i++) { paintBox(g2, 7 + b[i][0], HEIGHT_C + 2 + b[i][1], COLORS[next_si + 1]); } } } else if (end) { g2.setColor(Color.BLACK); g2.fillRect(2 * CELL, 9 * CELL, 8 * CELL, 4 * CELL); g2.setColor(Color.WHITE); g2.drawRect(2 * CELL, 9 * CELL, 8 * CELL, 4 * CELL); g2.drawString("GAME OVER! SCORE: " + score, (WIDTH_C - 6) * CELL / 2 + 2, (HEIGHT_C + 2) * CELL / 2); } g2.dispose(); g.drawImage(img, 0, 0, this); }
|
public void paint(Graphics g) { if (img == null) { img = createImage(DIM.width, DIM.height); } Graphics g2 = img.getGraphics(); g2.setColor(COLORS[0]); g2.fillRect(0, 0, DIM.width, DIM.height); for (int i = 0; i < WIDTH_C + 2; i++) { for (int j = 0; j < HEIGHT_C + 2; j++) { int ci = WORLD[i][j]; if (ci > 0) paintBox(g2, i, j, COLORS[ci]); } } { Color c = COLORS[COLORS.length - 1]; for (int i = 0; i < WIDTH_C + 2; i++) { paintBox(g2, i, HEIGHT_C + 6, c); } for (int j = 0; j < 4; j++) { paintBox(g2, 0, HEIGHT_C + 2 + j, c); paintBox(g2, 5, HEIGHT_C + 2 + j, c); // paintBox(g2, 6, HEIGHT_C + 2 +j, c ); paintBox(g2, WIDTH_C + 1, HEIGHT_C + 2 + j, c); } } if (isUp()) { int[][] b = BLOCKS[si][bi]; for (int i = 0; i < b.length; i++) { paintBox(g2, x + b[i][0], y + b[i][1], COLORS[si + 1]); } { g2.setColor(Color.WHITE); g2.drawString("SCORE:", CELL + 2, (HEIGHT_C + 4) * CELL - 4); g2.drawString(String.valueOf(score), 2 * CELL, (HEIGHT_C + 5) * CELL - 4); b = BLOCKS[next_si][next_bi]; for (int i = 0; i < b.length; i++) { paintBox(g2, 7 + b[i][0], HEIGHT_C + 2 + b[i][1], COLORS[next_si + 1]); } } } else if (end) { g2.setColor(Color.BLACK); g2.fillRect(2 * CELL, 9 * CELL, 8 * CELL, 4 * CELL); g2.setColor(Color.WHITE); g2.drawRect(2 * CELL, 9 * CELL, 8 * CELL, 4 * CELL); g2.drawString("GAME OVER! SCORE: " + score, (WIDTH_C - 6) * CELL / 2 + 2, (HEIGHT_C + 2) * CELL / 2); } g2.dispose(); g.drawImage(img, 0, 0, this); }
| 3,848
|
public SwingChoicePeer(SwingToolkit toolkit, Choice choice) { super(toolkit, choice, new JComboBox()); this.choice = choice; final JComboBox combo = (JComboBox)jComponent; combo.setModel(new DefaultComboBoxModel()); SwingToolkit.add(choice, combo); SwingToolkit.copyAwtProperties(choice, combo); final int cnt = choice.getItemCount(); for (int i = 0; i < cnt; i++) { addItem(choice.getItem(i), i); } }
|
public SwingChoicePeer(SwingToolkit toolkit, Choice choice) { super(toolkit, choice, new JComboBox()); this.choice = choice; final JComboBox combo = (JComboBox)jComponent; combo.setModel(new DefaultComboBoxModel()); SwingToolkit.add(choice, combo); SwingToolkit.copyAwtProperties(choice, combo); final int cnt = choice.getItemCount(); for (int i = 0; i < cnt; i++) { addItem(choice.getItem(i), i); } }
| 3,849
|
public abstract void addItem(String item, int index);
|
void addItem (String item, int index);
| 3,850
|
public static final DateFormat getTimeInstance (int style, Locale loc) { return computeInstance (style, loc, false, true); }
|
public static final DateFormat getTimeInstance () { return computeInstance (style, loc, false, true); }
| 3,851
|
public static final DateFormat getTimeInstance (int style, Locale loc) { return computeInstance (style, loc, false, true); }
|
public static final DateFormat getTimeInstance (int style, Locale loc) { return getTimeInstance (DEFAULT, Locale.getDefault()); }
| 3,852
|
public static Locale[] getAvailableLocales() { /* I only return those for which localized language * or country information exists. * XXX - remove hard coded list, and implement more locales (Sun's JDK 1.4 * has 148 installed locales!). */ return new Locale[] { ENGLISH, FRENCH, GERMAN, new Locale("ga", "") }; }
|
public static synchronized Locale[] getAvailableLocales() { /* I only return those for which localized language * or country information exists. * XXX - remove hard coded list, and implement more locales (Sun's JDK 1.4 * has 148 installed locales!). */ return new Locale[] { ENGLISH, FRENCH, GERMAN, new Locale("ga", "") }; }
| 3,853
|
public static Locale[] getAvailableLocales() { /* I only return those for which localized language * or country information exists. * XXX - remove hard coded list, and implement more locales (Sun's JDK 1.4 * has 148 installed locales!). */ return new Locale[] { ENGLISH, FRENCH, GERMAN, new Locale("ga", "") }; }
|
public static Locale[] getAvailableLocales() { /* I only return those for which localized language * or country information exists. * XXX - remove hard coded list, and implement more locales (Sun's JDK 1.4 * has 148 installed locales!). */ if (availableLocales == null) { ENGLISH, FRENCH, GERMAN, new Locale("ga", "") }; }
| 3,854
|
public static Locale[] getAvailableLocales() { /* I only return those for which localized language * or country information exists. * XXX - remove hard coded list, and implement more locales (Sun's JDK 1.4 * has 148 installed locales!). */ return new Locale[] { ENGLISH, FRENCH, GERMAN, new Locale("ga", "") }; }
|
public static Locale[] getAvailableLocales() { /* I only return those for which localized language * or country information exists. * XXX - remove hard coded list, and implement more locales (Sun's JDK 1.4 * has 148 installed locales!). */ return new Locale[] { ENGLISH, FRENCH, GERMAN, new Locale("ga", "") }; }
| 3,855
|
void clear(int index) { offset = index; this.index = 0; for (int i = 0; i < start.length; i++) { start[i] = end[i] = -1; } next = null; // cut off alternates empty = false; }
|
void clear(int index) { offset = index; this.index = 0; for (int i = 0; i < start.length; i++) { start[i] = end[i] = -1; } next = null; // cut off alternates }
| 3,856
|
InetAddress(byte[] ipaddr, String hostname) { addr = (null == ipaddr) ? null : (byte[]) ipaddr.clone(); hostName = hostname; lookup_time = System.currentTimeMillis(); family = 2; /* AF_INET */ }
|
InetAddress(byte[] ipaddr, String hostname) { addr = (null == ipaddr) ? null : (byte[]) ipaddr.clone(); hostName = hostname; family = 2; /* AF_INET */ }
| 3,858
|
public static InetAddress[] getAllByName(String hostname) throws UnknownHostException { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkConnect(hostname, -1); InetAddress[] addresses; // Default to current host if necessary if (hostname == null) { addresses = new InetAddress[1]; addresses[0] = LOCALHOST; return addresses; } // Check the cache for this host before doing a lookup addresses = checkCacheFor(hostname); if (addresses != null) return addresses; // Not in cache, try the lookup byte[][] iplist = VMInetAddress.getHostByName(hostname); if (iplist.length == 0) throw new UnknownHostException(hostname); addresses = new InetAddress[iplist.length]; for (int i = 0; i < iplist.length; i++) { if (iplist[i].length != 4) throw new UnknownHostException(hostname); addresses[i] = new Inet4Address(iplist[i], hostname); } addToCache(hostname, addresses); return addresses; }
|
public static InetAddress[] getAllByName(String hostname) throws UnknownHostException { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkConnect(hostname, -1); InetAddress[] addresses; // Default to current host if necessary if (hostname == null || hostname.equals("")) { addresses = new InetAddress[1]; addresses[0] = LOCALHOST; return addresses; } // Check the cache for this host before doing a lookup addresses = checkCacheFor(hostname); if (addresses != null) return addresses; // Not in cache, try the lookup byte[][] iplist = VMInetAddress.getHostByName(hostname); if (iplist.length == 0) throw new UnknownHostException(hostname); addresses = new InetAddress[iplist.length]; for (int i = 0; i < iplist.length; i++) { if (iplist[i].length != 4) throw new UnknownHostException(hostname); addresses[i] = new Inet4Address(iplist[i], hostname); } addToCache(hostname, addresses); return addresses; }
| 3,859
|
public static InetAddress[] getAllByName(String hostname) throws UnknownHostException { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkConnect(hostname, -1); InetAddress[] addresses; // Default to current host if necessary if (hostname == null) { addresses = new InetAddress[1]; addresses[0] = LOCALHOST; return addresses; } // Check the cache for this host before doing a lookup addresses = checkCacheFor(hostname); if (addresses != null) return addresses; // Not in cache, try the lookup byte[][] iplist = VMInetAddress.getHostByName(hostname); if (iplist.length == 0) throw new UnknownHostException(hostname); addresses = new InetAddress[iplist.length]; for (int i = 0; i < iplist.length; i++) { if (iplist[i].length != 4) throw new UnknownHostException(hostname); addresses[i] = new Inet4Address(iplist[i], hostname); } addToCache(hostname, addresses); return addresses; }
|
public static InetAddress[] getAllByName(String hostname) throws UnknownHostException { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkConnect(hostname, -1); InetAddress[] addresses; // Default to current host if necessary if (hostname == null) { addresses = new InetAddress[1]; addresses[0] = LOCALHOST; return addresses; } // Check the cache for this host before doing a lookup addresses = checkCacheFor(hostname); if (addresses != null) return addresses; // Not in cache, try the lookup byte[][] iplist = VMInetAddress.getHostByName(hostname); if (iplist.length == 0) throw new UnknownHostException(hostname); addresses = new InetAddress[iplist.length]; for (int i = 0; i < iplist.length; i++) { if (iplist[i].length != 4) throw new UnknownHostException(hostname); addresses[i] = new Inet4Address(iplist[i], hostname); } addToCache(hostname, addresses); return addresses; }
| 3,860
|
public static InetAddress[] getAllByName(String hostname) throws UnknownHostException { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkConnect(hostname, -1); InetAddress[] addresses; // Default to current host if necessary if (hostname == null) { addresses = new InetAddress[1]; addresses[0] = LOCALHOST; return addresses; } // Check the cache for this host before doing a lookup addresses = checkCacheFor(hostname); if (addresses != null) return addresses; // Not in cache, try the lookup byte[][] iplist = VMInetAddress.getHostByName(hostname); if (iplist.length == 0) throw new UnknownHostException(hostname); addresses = new InetAddress[iplist.length]; for (int i = 0; i < iplist.length; i++) { if (iplist[i].length != 4) throw new UnknownHostException(hostname); addresses[i] = new Inet4Address(iplist[i], hostname); } addToCache(hostname, addresses); return addresses; }
|
public static InetAddress[] getAllByName(String hostname) throws UnknownHostException { SecurityManager s = System.getSecurityManager(); if (s != null) s.checkConnect(hostname, -1); InetAddress[] addresses; // Default to current host if necessary if (hostname == null) { addresses = new InetAddress[1]; addresses[0] = LOCALHOST; return addresses; } // Check the cache for this host before doing a lookup addresses = checkCacheFor(hostname); if (addresses != null) return addresses; // Not in cache, try the lookup byte[][] iplist = VMInetAddress.getHostByName(hostname); if (iplist.length == 0) throw new UnknownHostException(hostname); addresses = new InetAddress[iplist.length]; for (int i = 0; i < iplist.length; i++) { if (iplist[i].length != 4) throw new UnknownHostException(hostname); addresses[i] = new Inet4Address(iplist[i], hostname); } return addresses; }
| 3,861
|
Inet4Address(byte[] addr, String host) { this(addr, host, null); }
|
Inet4Address(byte[] addr) { this(addr, host, null); }
| 3,863
|
Inet4Address(byte[] addr, String host) { this(addr, host, null); }
|
Inet4Address(byte[] addr, String host) { this(addr, null, null); }
| 3,864
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JOptionPane.ICON_PROPERTY) || e.getPropertyName().equals(JOptionPane.MESSAGE_TYPE_PROPERTY)) addIcon(messageAreaContainer); else if (e.getPropertyName().equals(JOptionPane.INITIAL_SELECTION_VALUE_PROPERTY)) resetSelectedValue(); else if (e.getPropertyName().equals(JOptionPane.INITIAL_VALUE_PROPERTY) || e.getPropertyName().equals(JOptionPane.OPTIONS_PROPERTY) || e.getPropertyName().equals(JOptionPane.OPTION_TYPE_PROPERTY)) { Container newButtons = createButtonArea(); optionPane.remove(buttonContainer); optionPane.add(newButtons); buttonContainer = newButtons; } else if (e.getPropertyName().equals(JOptionPane.MESSAGE_PROPERTY) || e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY) || e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY)) { optionPane.removeAll(); messageAreaContainer = createMessageArea(); optionPane.add(messageAreaContainer); optionPane.add(buttonContainer); } optionPane.invalidate(); optionPane.repaint(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals(JOptionPane.ICON_PROPERTY) || e.getPropertyName().equals(JOptionPane.MESSAGE_TYPE_PROPERTY)) addIcon(messageAreaContainer); else if (e.getPropertyName().equals(JOptionPane.INITIAL_SELECTION_VALUE_PROPERTY)) resetSelectedValue(); else if (e.getPropertyName().equals(JOptionPane.INITIAL_VALUE_PROPERTY) || e.getPropertyName().equals(JOptionPane.OPTIONS_PROPERTY) || e.getPropertyName().equals(JOptionPane.OPTION_TYPE_PROPERTY)) { Container newButtons = createButtonArea(); optionPane.remove(buttonContainer); optionPane.add(newButtons); buttonContainer = newButtons; } else if (e.getPropertyName().equals(JOptionPane.MESSAGE_PROPERTY) || e.getPropertyName().equals(JOptionPane.WANTS_INPUT_PROPERTY) || e.getPropertyName().equals(JOptionPane.SELECTION_VALUES_PROPERTY)) { optionPane.removeAll(); messageAreaContainer = createMessageArea(); optionPane.add(messageAreaContainer); optionPane.add(buttonContainer); } optionPane.invalidate(); optionPane.repaint(); }
| 3,865
|
protected Container createMessageArea() { JPanel messageArea = new JPanel(); messageArea.setLayout(new BorderLayout()); addIcon(messageArea); JPanel rightSide = new JPanel(); rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0)); rightSide.setLayout(new GridBagLayout()); GridBagConstraints con = createConstraints(); addMessageComponents(rightSide, con, getMessage(), getMaxCharactersPerLineCount(), false); if (optionPane.getWantsInput()) { Object[] selection = optionPane.getSelectionValues(); if (selection == null) inputComponent = new JTextField(15); else if (selection.length < 20) inputComponent = new JComboBox(selection); else inputComponent = new JList(selection); if (inputComponent != null) { addMessageComponents(rightSide, con, inputComponent, getMaxCharactersPerLineCount(), false); resetSelectedValue(); selectInitialValue(optionPane); } } messageArea.add(rightSide, BorderLayout.EAST); return messageArea; }
|
protected Container createMessageArea() { JPanel messageArea = new JPanel(); messageArea.setLayout(new BorderLayout()); addIcon(messageArea); JPanel rightSide = new JPanel(); rightSide.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); rightSide.setLayout(new GridBagLayout()); GridBagConstraints con = createConstraints(); addMessageComponents(rightSide, con, getMessage(), getMaxCharactersPerLineCount(), false); if (optionPane.getWantsInput()) { Object[] selection = optionPane.getSelectionValues(); if (selection == null) inputComponent = new JTextField(15); else if (selection.length < 20) inputComponent = new JComboBox(selection); else inputComponent = new JList(selection); if (inputComponent != null) { addMessageComponents(rightSide, con, inputComponent, getMaxCharactersPerLineCount(), false); resetSelectedValue(); selectInitialValue(optionPane); } } messageArea.add(rightSide, BorderLayout.EAST); return messageArea; }
| 3,866
|
protected Container createMessageArea() { JPanel messageArea = new JPanel(); messageArea.setLayout(new BorderLayout()); addIcon(messageArea); JPanel rightSide = new JPanel(); rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0)); rightSide.setLayout(new GridBagLayout()); GridBagConstraints con = createConstraints(); addMessageComponents(rightSide, con, getMessage(), getMaxCharactersPerLineCount(), false); if (optionPane.getWantsInput()) { Object[] selection = optionPane.getSelectionValues(); if (selection == null) inputComponent = new JTextField(15); else if (selection.length < 20) inputComponent = new JComboBox(selection); else inputComponent = new JList(selection); if (inputComponent != null) { addMessageComponents(rightSide, con, inputComponent, getMaxCharactersPerLineCount(), false); resetSelectedValue(); selectInitialValue(optionPane); } } messageArea.add(rightSide, BorderLayout.EAST); return messageArea; }
|
protected Container createMessageArea() { JPanel messageArea = new JPanel(); messageArea.setLayout(new BorderLayout()); addIcon(messageArea); JPanel rightSide = new JPanel(); rightSide.setBorder(BorderFactory.createEmptyBorder(0, 11, 17, 0)); rightSide.setLayout(new GridBagLayout()); GridBagConstraints con = createConstraints(); addMessageComponents(rightSide, con, getMessage(), getMaxCharactersPerLineCount(), false); if (optionPane.getWantsInput()) { Object[] selection = optionPane.getSelectionValues(); if (selection == null) inputComponent = new JTextField(15); else if (selection.length < 20) inputComponent = new JComboBox(selection); else inputComponent = new JList(selection); if (inputComponent != null) { addMessageComponents(rightSide, con, inputComponent, getMaxCharactersPerLineCount(), false); resetSelectedValue(); selectInitialValue(optionPane); } } messageArea.add(rightSide, BorderLayout.CENTER); return messageArea; }
| 3,867
|
protected Object[] getButtons() { if (optionPane.getOptions() != null) return optionPane.getOptions(); switch (optionPane.getOptionType()) { case JOptionPane.YES_NO_OPTION: return new Object[] { YES_STRING, NO_STRING }; case JOptionPane.YES_NO_CANCEL_OPTION: return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING }; case JOptionPane.OK_CANCEL_OPTION: case JOptionPane.DEFAULT_OPTION: return new Object[] { OK_STRING, CANCEL_STRING }; } return null; }
|
protected Object[] getButtons() { if (optionPane.getOptions() != null) return optionPane.getOptions(); switch (optionPane.getOptionType()) { case JOptionPane.YES_NO_OPTION: return new Object[] { YES_STRING, NO_STRING }; case JOptionPane.YES_NO_CANCEL_OPTION: return new Object[] { YES_STRING, NO_STRING, CANCEL_STRING }; case JOptionPane.OK_CANCEL_OPTION: case JOptionPane.DEFAULT_OPTION: return (optionPane.getWantsInput() ) ? new Object[] { OK_STRING, CANCEL_STRING } : ( optionPane.getMessageType() == JOptionPane.QUESTION_MESSAGE ) ? new Object[] { YES_STRING, NO_STRING, CANCEL_STRING } : new Object[] { OK_STRING }; } return null; }
| 3,868
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); optionPane.setFont(defaults.getFont("OptionPane.font")); optionPane.setBackground(defaults.getColor("OptionPane.background")); optionPane.setForeground(defaults.getColor("OptionPane.foreground")); optionPane.setBorder(defaults.getBorder("OptionPane.border")); optionPane.setOpaque(true); messageBorder = defaults.getBorder("OptionPane.messageAreaBorder"); messageForeground = defaults.getColor("OptionPane.messageForeground"); buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder"); minimumSize = defaults.getDimension("OptionPane.minimumSize"); minimumWidth = minimumSize.width; minimumHeight = minimumSize.height; // FIXME: Image icons don't seem to work properly right now. // Once they do, replace the synthetic icons with these ones. /* warningIcon = (IconUIResource) defaults.getIcon("OptionPane.warningIcon"); infoIcon = (IconUIResource) defaults.getIcon("OptionPane.informationIcon"); errorIcon = (IconUIResource) defaults.getIcon("OptionPane.errorIcon"); questionIcon = (IconUIResource) defaults.getIcon("OptionPane.questionIcon"); */ }
|
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); optionPane.setFont(defaults.getFont("OptionPane.font")); optionPane.setBackground(defaults.getColor("OptionPane.background")); optionPane.setForeground(defaults.getColor("OptionPane.foreground")); optionPane.setBorder(defaults.getBorder("OptionPane.border")); optionPane.setOpaque(true); messageBorder = defaults.getBorder("OptionPane.messageAreaBorder"); messageForeground = defaults.getColor("OptionPane.messageForeground"); buttonBorder = defaults.getBorder("OptionPane.buttonAreaBorder"); minimumSize = defaults.getDimension("OptionPane.minimumSize"); minimumWidth = minimumSize.width; minimumHeight = minimumSize.height; // FIXME: Image icons don't seem to work properly right now. // Once they do, replace the synthetic icons with these ones. /* warningIcon = (IconUIResource) defaults.getIcon("OptionPane.warningIcon"); infoIcon = (IconUIResource) defaults.getIcon("OptionPane.informationIcon"); errorIcon = (IconUIResource) defaults.getIcon("OptionPane.errorIcon"); questionIcon = (IconUIResource) defaults.getIcon("OptionPane.questionIcon"); */ }
| 3,869
|
public static void debug(String msg) { if (priority > Priority.DEBUG) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.debug()"); e.printStackTrace(); } }
|
public static void debug(String msg) { if (priority > Priority.DEBUG) return; try { output.write(msg.getBytes()); } catch (IOException e) { System.err.println("error in Log.debug()"); e.printStackTrace(); } }
| 3,870
|
public static void error(String msg) { if (priority > Priority.ERROR) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.error()"); e.printStackTrace(); } }
|
public static void error(String msg) { if (priority > Priority.ERROR) return; try { output.write(msg.getBytes()); } catch (IOException e) { System.err.println("error in Log.error()"); e.printStackTrace(); } }
| 3,871
|
public static void info(String msg) { if (priority > Priority.INFO) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.info()"); e.printStackTrace(); } }
|
public static void info(String msg) { if (priority > Priority.INFO) return; try { output.write(msg.getBytes()); } catch (IOException e) { System.err.println("error in Log.info()"); e.printStackTrace(); } }
| 3,872
|
public static void warn(String msg) { if (priority > Priority.WARN) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.warn()"); e.printStackTrace(); } }
|
public static void warn(String msg) { if (priority > Priority.WARN) return; try { output.write(msg.getBytes()); } catch (IOException e) { System.err.println("error in Log.warn()"); e.printStackTrace(); } }
| 3,873
|
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset) { // This buffers the chars to be drawn. char[] buffer = s.array; // The current x and y pixel coordinates. int pixelX = x; int pixelY = y; // The font metrics of the current selected font. FontMetrics metrics = g.getFontMetrics(); int ascent = metrics.getAscent(); for (int offset = s.offset; offset < (s.offset + s.count); ++offset) { switch (buffer[offset]) { case '\t': // In case we have a tab, we just 'jump' over the tab. // When we have no tab expander we just use the width of 'm'. if (e != null) pixelX = (int) e.nextTabStop((float) pixelX, startOffset + offset - s.offset); else pixelX += metrics.charWidth(' '); break; case '\n': // In case we have a newline, we must draw // the buffer and jump on the next line. g.drawChars(buffer, offset, 1, pixelX, y); pixelY += metrics.getHeight(); pixelX = x; break; default: // Here we draw the char. g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent); pixelX += metrics.charWidth(buffer[offset]); break; } } return pixelX; }
|
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset) { // This buffers the chars to be drawn. char[] buffer = s.array; // The current x and y pixel coordinates. int pixelX = x; int pixelY = y; // The font metrics of the current selected font. FontMetrics metrics = g.getFontMetrics(); int ascent = metrics.getAscent(); for (int offset = s.offset; offset < (s.offset + s.count); ++offset) { char c = buffer[offset]; if (len > 0 && (c == '\t' || c == '\n')) { g.drawChars(buffer, pos, len, pixelX, pixelY + ascent); pixelX += pixelWidth; pixelWidth = 0; pos = offset+1; len = 0; } switch (c) { case '\t': // In case we have a tab, we just 'jump' over the tab. // When we have no tab expander we just use the width of 'm'. if (e != null) pixelX = (int) e.nextTabStop((float) pixelX, startOffset + offset - s.offset); else pixelX += metrics.charWidth(' '); break; case '\n': // In case we have a newline, we must draw // the buffer and jump on the next line. g.drawChars(buffer, offset, 1, pixelX, y); pixelY += metrics.getHeight(); pixelX = x; break; default: // Here we draw the char. g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent); pixelX += metrics.charWidth(buffer[offset]); break; } } return pixelX; }
| 3,874
|
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset) { // This buffers the chars to be drawn. char[] buffer = s.array; // The current x and y pixel coordinates. int pixelX = x; int pixelY = y; // The font metrics of the current selected font. FontMetrics metrics = g.getFontMetrics(); int ascent = metrics.getAscent(); for (int offset = s.offset; offset < (s.offset + s.count); ++offset) { switch (buffer[offset]) { case '\t': // In case we have a tab, we just 'jump' over the tab. // When we have no tab expander we just use the width of 'm'. if (e != null) pixelX = (int) e.nextTabStop((float) pixelX, startOffset + offset - s.offset); else pixelX += metrics.charWidth(' '); break; case '\n': // In case we have a newline, we must draw // the buffer and jump on the next line. g.drawChars(buffer, offset, 1, pixelX, y); pixelY += metrics.getHeight(); pixelX = x; break; default: // Here we draw the char. g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent); pixelX += metrics.charWidth(buffer[offset]); break; } } return pixelX; }
|
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset) { // This buffers the chars to be drawn. char[] buffer = s.array; // The current x and y pixel coordinates. int pixelX = x; int pixelY = y; // The font metrics of the current selected font. FontMetrics metrics = g.getFontMetrics(); int ascent = metrics.getAscent(); for (int offset = s.offset; offset < (s.offset + s.count); ++offset) { switch (buffer[offset]) { case '\t': // In case we have a tab, we just 'jump' over the tab. // When we have no tab expander we just use the width of 'm'. if (e != null) pixelX = (int) e.nextTabStop((float) pixelX, startOffset + offset - s.offset); else pixelX += metrics.charWidth(' '); break; case '\n': // In case we have a newline, we must draw // the buffer and jump on the next line. pixelY += metrics.getHeight(); pixelX = x; break; default: // Here we draw the char. g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent); pixelX += metrics.charWidth(buffer[offset]); break; } } return pixelX; }
| 3,875
|
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset) { // This buffers the chars to be drawn. char[] buffer = s.array; // The current x and y pixel coordinates. int pixelX = x; int pixelY = y; // The font metrics of the current selected font. FontMetrics metrics = g.getFontMetrics(); int ascent = metrics.getAscent(); for (int offset = s.offset; offset < (s.offset + s.count); ++offset) { switch (buffer[offset]) { case '\t': // In case we have a tab, we just 'jump' over the tab. // When we have no tab expander we just use the width of 'm'. if (e != null) pixelX = (int) e.nextTabStop((float) pixelX, startOffset + offset - s.offset); else pixelX += metrics.charWidth(' '); break; case '\n': // In case we have a newline, we must draw // the buffer and jump on the next line. g.drawChars(buffer, offset, 1, pixelX, y); pixelY += metrics.getHeight(); pixelX = x; break; default: // Here we draw the char. g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent); pixelX += metrics.charWidth(buffer[offset]); break; } } return pixelX; }
|
public static final int drawTabbedText(Segment s, int x, int y, Graphics g, TabExpander e, int startOffset) { // This buffers the chars to be drawn. char[] buffer = s.array; // The current x and y pixel coordinates. int pixelX = x; int pixelY = y; // The font metrics of the current selected font. FontMetrics metrics = g.getFontMetrics(); int ascent = metrics.getAscent(); for (int offset = s.offset; offset < (s.offset + s.count); ++offset) { switch (buffer[offset]) { case '\t': // In case we have a tab, we just 'jump' over the tab. // When we have no tab expander we just use the width of 'm'. if (e != null) pixelX = (int) e.nextTabStop((float) pixelX, startOffset + offset - s.offset); else pixelX += metrics.charWidth(' '); break; case '\n': // In case we have a newline, we must draw // the buffer and jump on the next line. g.drawChars(buffer, offset, 1, pixelX, y); pixelY += metrics.getHeight(); pixelX = x; break; default: // Here we draw the char. g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent); pixelX += metrics.charWidth(buffer[offset]); break; } } return pixelX; }
| 3,876
|
public SwingPanelPeer(SwingToolkit toolkit, Panel panel) { super(toolkit, panel, new JPanel()); final JPanel jPanel = (JPanel)jComponent; this.panel = panel; SwingToolkit.add(panel, jPanel); SwingToolkit.copyAwtProperties(panel, jPanel); }
|
public SwingPanelPeer(SwingToolkit toolkit, Panel panel) { super(toolkit, panel, new JPanel()); final JPanel jPanel = (JPanel)jComponent; this.panel = panel; SwingToolkit.add(panel, jPanel); SwingToolkit.copyAwtProperties(panel, jPanel); }
| 3,878
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
| 3,880
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
| 3,881
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
| 3,882
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
|
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets i = parent.getInsets(); boolean l2r = parent.getComponentOrientation().isLeftToRight(); /* -------------- -------------- | | n | | n | | | e | - | or | - | e | | | p | | p | | -------------- -------------- */ Dimension e = minSize(editor); Dimension n = minSize(next); Dimension p = minSize(previous); Dimension s = spinner.getPreferredSize(); int x = l2r ? i.left : i.right; int y = i.top; int w = Math.max(p.width, n.width); int h = Math.max(p.height, n.height); h = Math.max(h, e.height / 2); int e_width = s.width - w; if (l2r) { setBounds(editor, x, y + (s.height - e.height) / 2, e_width, e.height); x += e_width; setBounds(next, x, y, w, h); y += h; setBounds(previous, x, y + (s.height - e.height) / 2, w, h); } else { setBounds(next, x, y + (s.height - e.height) / 2, w, h); y += h; setBounds(previous, x, y + (s.height - e.height) / 2, w, h); x += w; y -= h; setBounds(editor, x, y, e_width, e.height); } } }
| 3,883
|
public Dimension minimumLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getMinimumSize(); d.width += tmp.width; d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getMinimumSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getMinimumSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
|
public Dimension minimumLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getMinimumSize(); d.width += tmp.width; d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; if (next != null) { Dimension tmp = next.getMinimumSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getMinimumSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
| 3,884
|
public Dimension minimumLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getMinimumSize(); d.width += tmp.width; d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getMinimumSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getMinimumSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
|
public Dimension minimumLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getMinimumSize(); d.width += tmp.width; d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getMinimumSize(); nextWidth = tmp.width; } if (previous != null) { Dimension tmp = previous.getMinimumSize(); previousWidth = tmp.width; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
| 3,885
|
public Dimension minimumLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getMinimumSize(); d.width += tmp.width; d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getMinimumSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getMinimumSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
|
public Dimension minimumLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getMinimumSize(); d.width += tmp.width; d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getMinimumSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getMinimumSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.width += Math.max(nextWidth, previousWidth); return d; }
| 3,886
|
public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getPreferredSize(); d.width += Math.max(tmp.width, 40); d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getPreferredSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getPreferredSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
|
public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getPreferredSize(); d.width += Math.max(tmp.width, 40); d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; if (next != null) { Dimension tmp = next.getPreferredSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getPreferredSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
| 3,887
|
public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getPreferredSize(); d.width += Math.max(tmp.width, 40); d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getPreferredSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getPreferredSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
|
public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getPreferredSize(); d.width += Math.max(tmp.width, 40); d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getPreferredSize(); nextWidth = tmp.width; } if (previous != null) { Dimension tmp = previous.getPreferredSize(); previousWidth = tmp.width; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
| 3,888
|
public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getPreferredSize(); d.width += Math.max(tmp.width, 40); d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getPreferredSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getPreferredSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.height = Math.max(d.height, otherHeight); d.width += Math.max(nextWidth, previousWidth); return d; }
|
public Dimension preferredLayoutSize(Container parent) { Dimension d = new Dimension(); if (editor != null) { Dimension tmp = editor.getPreferredSize(); d.width += Math.max(tmp.width, 40); d.height = tmp.height; } int nextWidth = 0; int previousWidth = 0; int otherHeight = 0; if (next != null) { Dimension tmp = next.getPreferredSize(); nextWidth = tmp.width; otherHeight += tmp.height; } if (previous != null) { Dimension tmp = previous.getPreferredSize(); previousWidth = tmp.width; otherHeight += tmp.height; } d.width += Math.max(nextWidth, previousWidth); return d; }
| 3,889
|
protected PropertyChangeListener createPropertyChangeListener() { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); } }; }
|
protected PropertyChangeListener createPropertyChangeListener() { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); } }; }
| 3,891
|
protected PropertyChangeListener createPropertyChangeListener() { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); } }; }
|
protected PropertyChangeListener createPropertyChangeListener() { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); } }; }
| 3,892
|
public void propertyChange(PropertyChangeEvent evt) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); }
|
public void propertyChange(PropertyChangeEvent event) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); }
| 3,893
|
public void propertyChange(PropertyChangeEvent evt) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); }
|
public void propertyChange(PropertyChangeEvent evt) { // FIXME: Add check for enabled property change. Need to // disable the buttons. if ("editor".equals(evt.getPropertyName())) BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(), (JComponent) evt.getNewValue()); }
| 3,894
|
protected void specificIOStyleToXDF( OutputStream outputstream,String indent) { boolean niceOutput = sPrettyXDFOutput; //write out the tags info String[] tags = getAxisTags(); List axisList = parentArray.getAxisList(); String axisId; String tag; int stop = axisList.size(); synchronized (axisList) { for (int i = 0; i <stop; i++) { axisId = ((AxisInterface) axisList.get(i)).getAxisId(); tag = tags[i]; if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + TagToAxisNodeName + " axisIdRef=\"" + axisId + "\"" + " tag = \"" + tag + "\"/>"); } } }
|
protected void specificIOStyleToXDF( OutputStream outputstream,String indent) { boolean niceOutput = Specification.getInstance().isPrettyXDFOutput(); //write out the tags info String[] tags = getAxisTags(); List axisList = parentArray.getAxisList(); String axisId; String tag; int stop = axisList.size(); synchronized (axisList) { for (int i = 0; i <stop; i++) { axisId = ((AxisInterface) axisList.get(i)).getAxisId(); tag = tags[i]; if (niceOutput) { writeOut(outputstream, Constants.NEW_LINE); writeOut(outputstream, indent); } writeOut(outputstream, "<" + TagToAxisNodeName + " axisIdRef=\"" + axisId + "\"" + " tag = \"" + tag + "\"/>"); } } }
| 3,896
|
ICC_ProfileGray() { super(ColorSpace.CS_GRAY); }
|
ICC_ProfileGray(int cspace) { super(ColorSpace.CS_GRAY); }
| 3,897
|
ICC_ProfileGray() { super(ColorSpace.CS_GRAY); }
|
ICC_ProfileGray() { super(cspace); whitePoint = getXYZData(icSigMediaWhitePointTag); }
| 3,898
|
public float getGamma() { return 0; }
|
public float getGamma() { short[] data = getCurve(icSigGrayTRCTag); if (data == null) throw new IllegalArgumentException("Couldn't read Gray TRC data."); if (data.length != 1) throw new ProfileDataException("TRC is a table, not a gamma value."); double gamma = (double) (data[0] & (0xFFFF)) / 256.0; return (float) gamma; }
| 3,899
|
public float[] getMediaWhitePoint() { return null; }
|
public float[] getMediaWhitePoint() { float[] wp = new float[3]; wp[0] = whitePoint[0]; wp[1] = whitePoint[1]; wp[2] = whitePoint[2]; return wp; }
| 3,900
|
public short[] getTRC() { return null; }
|
public short[] getTRC() { short[] data = getCurve(icSigGrayTRCTag); if (data == null) throw new IllegalArgumentException("Couldn't read Gray TRC data."); if (data.length <= 1) throw new ProfileDataException("Gamma value, not a TRC table."); return data; }
| 3,901
|
ICC_Profile(int profileID) { this.profileID = profileID; }
|
ICC_Profile(int profileID) { header = null; tagTable = null; createProfile(profileID); }
| 3,902
|
public SwingCheckboxPeer(SwingToolkit toolkit, Checkbox checkBox) { super(toolkit, checkBox, new JCheckBox()); this.checkBox = checkBox; final JCheckBox jcb = (JCheckBox)jComponent; SwingToolkit.add(checkBox, jcb); SwingToolkit.copyAwtProperties(checkBox, jcb); jcb.setText(checkBox.getLabel()); setState(checkBox.getState()); }
|
public SwingCheckboxPeer(SwingToolkit toolkit, Checkbox checkBox) { super(toolkit, checkBox, new JCheckBox()); this.checkBox = checkBox; final JCheckBox jcb = (JCheckBox)jComponent; SwingToolkit.add(checkBox, jcb); SwingToolkit.copyAwtProperties(checkBox, jcb); jcb.setText(checkBox.getLabel()); setState(checkBox.getState()); }
| 3,903
|
private void paintSimple(Graphics g, JViewport v, Component view, Point pos, Rectangle viewBounds, Rectangle portBounds) { Rectangle oldClip = g.getClipBounds(); g.setClip(portBounds); g.translate (-pos.x, -pos.y); try { view.paint(g); } finally { g.translate (pos.x, pos.y); g.setClip (oldClip); } }
|
private void paintSimple(Graphics g, JViewport v, Component view, Point pos, Rectangle viewBounds, Rectangle portBounds) { Rectangle oldClip = g.getClipBounds(); g.setClip(new Rectangle(0, 0, portBounds.width, portBounds.height)); g.translate (-pos.x, -pos.y); try { view.paint(g); } finally { g.translate (pos.x, pos.y); g.setClip (oldClip); } }
| 3,904
|
public final int getRGB (int pixel) { if (pixel < map_size) return rgb[pixel]; return 0; }
|
public final int getRGB (int pixel) { if (pixel >= 0 && pixel < map_size) return rgb[pixel]; return 0; }
| 3,905
|
public static void checkPermission(Permission perm) throws AccessControlException { if (!Unsafe.getCurrentProcessor().isThreadSwitchActive()) { // getContext().checkPermission(perm); // This is an optimized version of // getContext().checkPermission() // that does not require any memory allocations. final VmStackReader reader = Unsafe.getCurrentProcessor() .getArchitecture().getStackReader(); Address sf = VmMagic.getCurrentFrame(); int recursionCount = 0; while (reader.isValid(sf)) { final VmMethod method = reader.getMethod(sf); if (method.hasDoPrivilegedPragma()) { // Stop here with the current thread's stacktrace. break; } else if (method.hasCheckPermissionPragma()) { // Be paranoia for now, let's check for recursive // checkPermission calls. recursionCount++; if (recursionCount > 2) { reader.debugStackTrace(); Unsafe.die("Recursive checkPermission"); } } else { final VmType<?> declClass = method.getDeclaringClass(); final ProtectionDomain pd = declClass.getProtectionDomain(); if (pd != null) { // Unsafe.debug(":pd"); if (!pd.implies(perm)) { // Unsafe.debug("Permission denied"); throw new AccessControlException("Permission \"" + perm + "\" not granted due to " + declClass.getName()); } } } if (method.hasPrivilegedActionPragma()) { // Break here, do not include inherited thread context return; } sf = reader.getPrevious(sf); } final VmThread thread = VmThread.currentThread(); final VmAccessControlContext inheritedCtx = thread.getContext(); if (inheritedCtx != null) { inheritedCtx.checkPermission(perm); } } }
|
public static void checkPermission(Permission perm) throws AccessControlException { if (!Unsafe.getCurrentProcessor().isThreadSwitchActive()) { // getContext().checkPermission(perm); // This is an optimized version of // getContext().checkPermission() // that does not require any memory allocations. final VmStackReader reader = Unsafe.getCurrentProcessor() .getArchitecture().getStackReader(); final VmStackFrameEnumerator sfEnum = new VmStackFrameEnumerator(reader); int recursionCount = 0; while (reader.isValid(sf)) { final VmMethod method = reader.getMethod(sf); if (method.hasDoPrivilegedPragma()) { // Stop here with the current thread's stacktrace. break; } else if (method.hasCheckPermissionPragma()) { // Be paranoia for now, let's check for recursive // checkPermission calls. recursionCount++; if (recursionCount > 2) { reader.debugStackTrace(); Unsafe.die("Recursive checkPermission"); } } else { final VmType<?> declClass = method.getDeclaringClass(); final ProtectionDomain pd = declClass.getProtectionDomain(); if (pd != null) { // Unsafe.debug(":pd"); if (!pd.implies(perm)) { // Unsafe.debug("Permission denied"); throw new AccessControlException("Permission \"" + perm + "\" not granted due to " + declClass.getName()); } } } if (method.hasPrivilegedActionPragma()) { // Break here, do not include inherited thread context return; } sf = reader.getPrevious(sf); } final VmThread thread = VmThread.currentThread(); final VmAccessControlContext inheritedCtx = thread.getContext(); if (inheritedCtx != null) { inheritedCtx.checkPermission(perm); } } }
| 3,906
|
public static void checkPermission(Permission perm) throws AccessControlException { if (!Unsafe.getCurrentProcessor().isThreadSwitchActive()) { // getContext().checkPermission(perm); // This is an optimized version of // getContext().checkPermission() // that does not require any memory allocations. final VmStackReader reader = Unsafe.getCurrentProcessor() .getArchitecture().getStackReader(); Address sf = VmMagic.getCurrentFrame(); int recursionCount = 0; while (reader.isValid(sf)) { final VmMethod method = reader.getMethod(sf); if (method.hasDoPrivilegedPragma()) { // Stop here with the current thread's stacktrace. break; } else if (method.hasCheckPermissionPragma()) { // Be paranoia for now, let's check for recursive // checkPermission calls. recursionCount++; if (recursionCount > 2) { reader.debugStackTrace(); Unsafe.die("Recursive checkPermission"); } } else { final VmType<?> declClass = method.getDeclaringClass(); final ProtectionDomain pd = declClass.getProtectionDomain(); if (pd != null) { // Unsafe.debug(":pd"); if (!pd.implies(perm)) { // Unsafe.debug("Permission denied"); throw new AccessControlException("Permission \"" + perm + "\" not granted due to " + declClass.getName()); } } } if (method.hasPrivilegedActionPragma()) { // Break here, do not include inherited thread context return; } sf = reader.getPrevious(sf); } final VmThread thread = VmThread.currentThread(); final VmAccessControlContext inheritedCtx = thread.getContext(); if (inheritedCtx != null) { inheritedCtx.checkPermission(perm); } } }
|
public static void checkPermission(Permission perm) throws AccessControlException { if (!Unsafe.getCurrentProcessor().isThreadSwitchActive()) { // getContext().checkPermission(perm); // This is an optimized version of // getContext().checkPermission() // that does not require any memory allocations. final VmStackReader reader = Unsafe.getCurrentProcessor() .getArchitecture().getStackReader(); Address sf = VmMagic.getCurrentFrame(); int recursionCount = 0; while (reader.isValid(sf)) { final VmMethod method = reader.getMethod(sf); if (method.hasDoPrivilegedPragma()) { // Stop here with the current thread's stacktrace. break; } else if (method.hasCheckPermissionPragma()) { // Be paranoia for now, let's check for recursive // checkPermission calls. recursionCount++; if (recursionCount > 2) { reader.debugStackTrace(); Unsafe.die("Recursive checkPermission"); } } else { final VmType<?> declClass = method.getDeclaringClass(); final ProtectionDomain pd = declClass.getProtectionDomain(); if (pd != null) { // Unsafe.debug(":pd"); if (!pd.implies(perm)) { // Unsafe.debug("Permission denied"); throw new AccessControlException("Permission \"" + perm + "\" not granted due to " + declClass.getName()); } } } if (method.hasPrivilegedActionPragma()) { // Break here, do not include inherited thread context return; } sf = reader.getPrevious(sf); } final VmThread thread = VmThread.currentThread(); final VmAccessControlContext inheritedCtx = thread.getContext(); if (inheritedCtx != null) { inheritedCtx.checkPermission(perm); } } }
| 3,907
|
public static void checkPermission(Permission perm) throws AccessControlException { if (!Unsafe.getCurrentProcessor().isThreadSwitchActive()) { // getContext().checkPermission(perm); // This is an optimized version of // getContext().checkPermission() // that does not require any memory allocations. final VmStackReader reader = Unsafe.getCurrentProcessor() .getArchitecture().getStackReader(); Address sf = VmMagic.getCurrentFrame(); int recursionCount = 0; while (reader.isValid(sf)) { final VmMethod method = reader.getMethod(sf); if (method.hasDoPrivilegedPragma()) { // Stop here with the current thread's stacktrace. break; } else if (method.hasCheckPermissionPragma()) { // Be paranoia for now, let's check for recursive // checkPermission calls. recursionCount++; if (recursionCount > 2) { reader.debugStackTrace(); Unsafe.die("Recursive checkPermission"); } } else { final VmType<?> declClass = method.getDeclaringClass(); final ProtectionDomain pd = declClass.getProtectionDomain(); if (pd != null) { // Unsafe.debug(":pd"); if (!pd.implies(perm)) { // Unsafe.debug("Permission denied"); throw new AccessControlException("Permission \"" + perm + "\" not granted due to " + declClass.getName()); } } } if (method.hasPrivilegedActionPragma()) { // Break here, do not include inherited thread context return; } sf = reader.getPrevious(sf); } final VmThread thread = VmThread.currentThread(); final VmAccessControlContext inheritedCtx = thread.getContext(); if (inheritedCtx != null) { inheritedCtx.checkPermission(perm); } } }
|
public static void checkPermission(Permission perm) throws AccessControlException { if (!Unsafe.getCurrentProcessor().isThreadSwitchActive()) { // getContext().checkPermission(perm); // This is an optimized version of // getContext().checkPermission() // that does not require any memory allocations. final VmStackReader reader = Unsafe.getCurrentProcessor() .getArchitecture().getStackReader(); Address sf = VmMagic.getCurrentFrame(); int recursionCount = 0; while (reader.isValid(sf)) { final VmMethod method = reader.getMethod(sf); if (method.hasDoPrivilegedPragma()) { // Stop here with the current thread's stacktrace. break; } else if (method.hasCheckPermissionPragma()) { // Be paranoia for now, let's check for recursive // checkPermission calls. recursionCount++; if (recursionCount > 2) { reader.debugStackTrace(); Unsafe.die("Recursive checkPermission"); } } else { final VmType<?> declClass = method.getDeclaringClass(); final ProtectionDomain pd = declClass.getProtectionDomain(); if (pd != null) { // Unsafe.debug(":pd"); if (!pd.implies(perm)) { // Unsafe.debug("Permission denied"); throw new AccessControlException("Permission \"" + perm + "\" not granted due to " + declClass.getName()); } } } if (method.hasPrivilegedActionPragma()) { // Break here, do not include inherited thread context return; } sfEnum.next(); } final VmThread thread = VmThread.currentThread(); final VmAccessControlContext inheritedCtx = thread.getContext(); if (inheritedCtx != null) { inheritedCtx.checkPermission(perm); } } }
| 3,908
|
public final void pop(int type) { if (tos <= 0) { throw new Error("Stack is empty"); } if (stack[ --tos] != type) { throw new Error("TypeStack[" + tos + "] is not the expected element " + type + " but " + stack[ tos]); } }
|
public final int pop() { if (tos <= 0) { throw new Error("Stack is empty"); } if (stack[ --tos] != type) { throw new Error("TypeStack[" + tos + "] is not the expected element " + type + " but " + stack[ tos]); } }
| 3,909
|
public final void pop(int type) { if (tos <= 0) { throw new Error("Stack is empty"); } if (stack[ --tos] != type) { throw new Error("TypeStack[" + tos + "] is not the expected element " + type + " but " + stack[ tos]); } }
|
public final void pop(int type) { if (tos <= 0) { throw new Error("Stack is empty"); } if (stack[ --tos] != type) { throw new Error("TypeStack[" + tos + "] is not the expected element " + type + " but " + stack[ tos]); } }
| 3,910
|
private void calculateDay(int[] fields, long day, boolean gregorian) { // the epoch is a Thursday. int weekday = (int) (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year too big. int year = 1970 + (int) (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; long firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = (int) day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = ((int) day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
|
private void calculateDay(int[] fields, long day, boolean gregorian) { // the epoch is a Thursday. int weekday = (int) (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year too big. int year = 1970 + (int) (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; long firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = (int) day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = ((int) day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
| 3,911
|
private void calculateDay(int[] fields, long day, boolean gregorian) { // the epoch is a Thursday. int weekday = (int) (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year too big. int year = 1970 + (int) (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; long firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = (int) day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year, gregorian) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = ((int) day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
|
private void calculateDay(int[] fields, long day, boolean gregorian) { // the epoch is a Thursday. int weekday = (int) (day + THURSDAY) % 7; if (weekday <= 0) weekday += 7; fields[DAY_OF_WEEK] = weekday; // get a first approximation of the year. This may be one // year too big. int year = 1970 + (int) (gregorian ? ((day - 100) * 400) / (365 * 400 + 100 - 4 + 1) : ((day - 100) * 4) / (365 * 4 + 1)); if (day >= 0) year++; long firstDayOfYear = getLinearDay(year, 1, gregorian); // Now look in which year day really lies. if (day < firstDayOfYear) { year--; firstDayOfYear = getLinearDay(year, 1, gregorian); } day -= firstDayOfYear - 1; // day of year, one based. fields[DAY_OF_YEAR] = (int) day; if (year <= 0) { fields[ERA] = BC; fields[YEAR] = 1 - year; } else { fields[ERA] = AD; fields[YEAR] = year; } int leapday = isLeapYear(year) ? 1 : 0; if (day <= 31 + 28 + leapday) { fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH]; } else { // A few more magic formulas int scaledDay = ((int) day - leapday) * 5 + 8; fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31); fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1; } }
| 3,912
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,913
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,914
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
|
protected synchronized void computeTime() { int era = isSet[ERA] ? fields[ERA] : AD; int year = isSet[YEAR] ? fields[YEAR] : 1970; if (isLenient() && isSet[MONTH]) { int month = fields[MONTH]; year += month / 12; month %= 12; if (month < 0) { month += 12; year--; } fields[MONTH] = month; isSet[YEAR] = true; fields[YEAR] = year; } if (era == BC) year = 1 - year; int[] daysOfYear = getDayOfYear(year); int hour = 0; if (isSet[HOUR_OF_DAY]) hour = fields[HOUR_OF_DAY]; else if (isSet[HOUR]) { hour = fields[HOUR]; if (isSet[AM_PM] && fields[AM_PM] == PM) if (hour != 12) /* not Noon */ hour += 12; /* Fix the problem of the status of 12:00 AM (midnight). */ if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12) hour = 0; } int minute = isSet[MINUTE] ? fields[MINUTE] : 0; int second = isSet[SECOND] ? fields[SECOND] : 0; int millis = isSet[MILLISECOND] ? fields[MILLISECOND] : 0; int millisInDay; if (isLenient()) { // prevent overflow long allMillis = (((hour * 60L) + minute) * 60L + second) * 1000L + millis; daysOfYear[1] += allMillis / (24 * 60 * 60 * 1000L); millisInDay = (int) (allMillis % (24 * 60 * 60 * 1000L)); } else { if (hour < 0 || hour >= 24 || minute < 0 || minute > 59 || second < 0 || second > 59 || millis < 0 || millis >= 1000) throw new IllegalArgumentException(); millisInDay = (((hour * 60) + minute) * 60 + second) * 1000 + millis; } time = getLinearTime(year, daysOfYear[0], millisInDay); // Add the relative days after calculating the linear time, to // get right behaviour when jumping over the gregorianCutover. time += daysOfYear[1] * (24 * 60 * 60 * 1000L); TimeZone zone = getTimeZone(); int rawOffset = isSet[ZONE_OFFSET] ? fields[ZONE_OFFSET] : zone.getRawOffset(); int day = (int) (time / (24 * 60 * 60 * 1000L)); millisInDay = (int) (time % (24 * 60 * 60 * 1000L)); if (millisInDay < 0) { millisInDay += (24 * 60 * 60 * 1000); day--; } int[] f = new int[FIELD_COUNT]; calculateDay(f, day, time - rawOffset >= gregorianCutover); year = f[YEAR]; int month = f[MONTH]; day = f[DAY_OF_MONTH]; int weekday = f[DAY_OF_WEEK]; int dstOffset = isSet[DST_OFFSET] ? fields[DST_OFFSET] : (zone.getOffset((year < 0) ? BC : AD, (year < 0) ? 1 - year : year, month, day, weekday, millisInDay) - zone.getRawOffset()); time -= rawOffset + dstOffset; isTimeSet = true; }
| 3,915
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.