rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (index < 0 || index >= attributeCount) throw new ArrayIndexOutOfBoundsException (); return attributeSpecified [index];
return ((Attribute) attributesList.get(index)).specified;
public boolean isSpecified (int index) { if (index < 0 || index >= attributeCount) throw new ArrayIndexOutOfBoundsException (); return attributeSpecified [index]; }
attributeSpecified = new boolean[10]; attributeDeclared = new boolean[10];
private void reset () { elementName = null; entityStack = new Stack (); attributesList = Collections.synchronizedList(new ArrayList()); attributeSpecified = new boolean[10]; attributeDeclared = new boolean[10]; attributeCount = 0; attributes = false; nsTemp = new String[3]; prefixStack = null; }
Object attribute[] = getAttribute (name, aname); if (attribute == null) { return null; } else { return (String) attribute [0]; }
AttributeDecl attribute = getAttribute(name, aname); return (attribute == null) ? null : attribute.type;
public String getAttributeType (String name, String aname) { Object attribute[] = getAttribute (name, aname); if (attribute == null) { return null; } else { return (String) attribute [0]; } }
void doParse ( String systemId, String publicId, Reader reader, InputStream stream, String encoding ) throws Exception { if (handler == null) throw new IllegalStateException ("no callback handler");
void doParse(String systemId, String publicId, Reader reader, InputStream stream, String encoding) throws Exception { if (handler == null) { throw new IllegalStateException("no callback handler"); }
void doParse ( String systemId, String publicId, Reader reader, InputStream stream, String encoding ) throws Exception { if (handler == null) throw new IllegalStateException ("no callback handler"); initializeVariables (); // predeclare the built-in entities here (replacement texts) // we don't need to intern(), since we're guaranteed literals // are always (globally) interned. setInternalEntity ("amp", "&#38;"); setInternalEntity ("lt", "&#60;"); setInternalEntity ("gt", "&#62;"); setInternalEntity ("apos", "&#39;"); setInternalEntity ("quot", "&#34;"); try { // pushURL first to ensure locator is correct in startDocument // ... it might report an IO or encoding exception. handler.startDocument (); pushURL (false, "[document]", // default baseURI: null new String [] { publicId, systemId, null}, reader, stream, encoding, false); parseDocument (); } catch (EOFException e){ //empty input error("empty document, with no root element."); }finally { if (reader != null) try { reader.close (); } catch (IOException e) { /* ignore */ } if (stream != null) try { stream.close (); } catch (IOException e) { /* ignore */ } if (is != null) try { is.close (); } catch (IOException e) { /* ignore */ } if (reader != null) try { reader.close (); } catch (IOException e) { /* ignore */ } scratch = null; } }
try { handler.startDocument (); pushURL (false, "[document]", new String [] { publicId, systemId, null}, reader, stream, encoding, false); parseDocument (); } catch (EOFException e){ error("empty document, with no root element."); }finally { if (reader != null) try { reader.close (); } catch (IOException e) { } if (stream != null) try { stream.close (); } catch (IOException e) { } if (is != null) try { is.close (); } catch (IOException e) { } if (reader != null) try { reader.close (); } catch (IOException e) { } scratch = null; } }
try { handler.startDocument(); pushURL(false, "[document]", new ExternalIdentifiers(publicId, systemId, null), reader, stream, encoding, false); parseDocument(); } catch (EOFException e) { error("empty document, with no root element."); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { } } if (stream != null) { try { stream.close(); } catch (IOException e) { } } if (is != null) { try { is.close(); } catch (IOException e) { } } scratch = null; } }
void doParse ( String systemId, String publicId, Reader reader, InputStream stream, String encoding ) throws Exception { if (handler == null) throw new IllegalStateException ("no callback handler"); initializeVariables (); // predeclare the built-in entities here (replacement texts) // we don't need to intern(), since we're guaranteed literals // are always (globally) interned. setInternalEntity ("amp", "&#38;"); setInternalEntity ("lt", "&#60;"); setInternalEntity ("gt", "&#62;"); setInternalEntity ("apos", "&#39;"); setInternalEntity ("quot", "&#34;"); try { // pushURL first to ensure locator is correct in startDocument // ... it might report an IO or encoding exception. handler.startDocument (); pushURL (false, "[document]", // default baseURI: null new String [] { publicId, systemId, null}, reader, stream, encoding, false); parseDocument (); } catch (EOFException e){ //empty input error("empty document, with no root element."); }finally { if (reader != null) try { reader.close (); } catch (IOException e) { /* ignore */ } if (stream != null) try { stream.close (); } catch (IOException e) { /* ignore */ } if (is != null) try { is.close (); } catch (IOException e) { /* ignore */ } if (reader != null) try { reader.close (); } catch (IOException e) { /* ignore */ } scratch = null; } }
public Throwable getException() { return containedException; }
public Throwable getException() { return cause; }
public Throwable getException() { return containedException; }
public String getLocationAsString() { if (locator == null) return null; StringBuffer retval = new StringBuffer (); if (locator.getPublicId () != null) { retval.append ("public='"); retval.append (locator.getPublicId ()); retval.append ("' "); } if (locator.getSystemId () != null) { retval.append ("uri='"); retval.append (locator.getSystemId ()); retval.append ("' "); } if (locator.getLineNumber () != -1) { retval.append ("line="); retval.append (locator.getLineNumber ()); retval.append (" "); } if (locator.getColumnNumber () != -1) { retval.append ("column="); retval.append (locator.getColumnNumber ()); } return retval.toString ();
public String getLocationAsString() { if (locator == null) { return null;
public String getLocationAsString() { if (locator == null) return null; StringBuffer retval = new StringBuffer (); if (locator.getPublicId () != null) { retval.append ("public='"); retval.append (locator.getPublicId ()); retval.append ("' "); } if (locator.getSystemId () != null) { retval.append ("uri='"); retval.append (locator.getSystemId ()); retval.append ("' "); } if (locator.getLineNumber () != -1) { retval.append ("line="); retval.append (locator.getLineNumber ()); retval.append (" "); } if (locator.getColumnNumber () != -1) { retval.append ("column="); retval.append (locator.getColumnNumber ()); //retval.append (" "); } return retval.toString (); }
String publicId = locator.getPublicId(); String systemId = locator.getSystemId(); int lineNumber = locator.getLineNumber(); int columnNumber = locator.getColumnNumber(); StringBuffer buffer = new StringBuffer (); if (publicId != null) { buffer.append ("publicId="); buffer.append (publicId); } if (systemId != null) { if (buffer.length() > 0) { buffer.append(' '); } buffer.append ("systemId="); buffer.append (systemId); } if (lineNumber != -1) { if (buffer.length() > 0) { buffer.append(' '); } buffer.append ("lineNumber="); buffer.append (lineNumber); } if (columnNumber != -1) { if (buffer.length() > 0) { buffer.append(' '); } buffer.append ("columnNumber="); buffer.append (columnNumber); } return buffer.toString(); }
public String getLocationAsString() { if (locator == null) return null; StringBuffer retval = new StringBuffer (); if (locator.getPublicId () != null) { retval.append ("public='"); retval.append (locator.getPublicId ()); retval.append ("' "); } if (locator.getSystemId () != null) { retval.append ("uri='"); retval.append (locator.getSystemId ()); retval.append ("' "); } if (locator.getLineNumber () != -1) { retval.append ("line="); retval.append (locator.getLineNumber ()); retval.append (" "); } if (locator.getColumnNumber () != -1) { retval.append ("column="); retval.append (locator.getColumnNumber ()); //retval.append (" "); } return retval.toString (); }
public String getMessageAndLocation() { if (locator == null) return getMessage (); return getMessage () + ": " + getLocationAsString ();
public String getMessageAndLocation() { return (locator == null) ? getMessage() : getMessage() + ": " + getLocationAsString();
public String getMessageAndLocation() { if (locator == null) return getMessage (); return getMessage () + ": " + getLocationAsString (); }
public synchronized Throwable initCause(Throwable cause) { if (cause == this) throw new IllegalArgumentException (); if (containedException != null) throw new IllegalStateException (); containedException = cause; causeKnown = true; return cause;
public Throwable initCause(Throwable cause) { if (this.cause != null) { throw new IllegalStateException(); } if (cause == this) { throw new IllegalArgumentException();
public synchronized Throwable initCause(Throwable cause) { if (cause == this) throw new IllegalArgumentException (); if (containedException != null) throw new IllegalStateException (); containedException = cause; causeKnown = true;// FIXME: spec implies "this" may be the right value; another bug? return cause; }
this.cause = cause; return this; }
public synchronized Throwable initCause(Throwable cause) { if (cause == this) throw new IllegalArgumentException (); if (containedException != null) throw new IllegalStateException (); containedException = cause; causeKnown = true;// FIXME: spec implies "this" may be the right value; another bug? return cause; }
{
LiteralNode(Node source) { this.source = source; if (source.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attrs = source.getAttributes(); Node attr = attrs.getNamedItemNS(Stylesheet.XSL_NS, "exclude-result-prefixes"); if (attr != null) { elementExcludeResultPrefixes = new HashSet(); StringTokenizer st = new StringTokenizer(attr.getNodeValue()); while (st.hasMoreTokens()) { elementExcludeResultPrefixes.add(st.nextToken()); } } else { elementExcludeResultPrefixes = Collections.EMPTY_SET; } } else { elementExcludeResultPrefixes = null; } }
}
LiteralNode(Node source) { this.source = source; if (source.getNodeType() == Node.ELEMENT_NODE) { NamedNodeMap attrs = source.getAttributes(); Node attr = attrs.getNamedItemNS(Stylesheet.XSL_NS, "exclude-result-prefixes"); if (attr != null) { elementExcludeResultPrefixes = new HashSet(); StringTokenizer st = new StringTokenizer(attr.getNodeValue()); while (st.hasMoreTokens()) { elementExcludeResultPrefixes.add(st.nextToken()); } } else { elementExcludeResultPrefixes = Collections.EMPTY_SET; } } else { elementExcludeResultPrefixes = null; } }
{
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new LiteralNode(source); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
}
TemplateNode clone(Stylesheet stylesheet) { TemplateNode ret = new LiteralNode(source); if (children != null) { ret.children = children.clone(stylesheet); } if (next != null) { ret.next = next.clone(stylesheet); } return ret; }
{
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Node result = null; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); short nodeType = source.getNodeType(); if (nodeType == Node.ATTRIBUTE_NODE && parent.getFirstChild() != null) { // Ignore attributes added after child elements } else { // Namespace aliasing if (nodeType == Node.ELEMENT_NODE) { String prefix = source.getPrefix(); if (prefix == null) { prefix = "#default"; } String resultPrefix = (String) stylesheet.namespaceAliases.get(prefix); if (resultPrefix != null) { if ("#default".equals(resultPrefix)) { resultPrefix = null; } String uri = source.lookupNamespaceURI(resultPrefix); String name = source.getNodeName(); // Create a new element node in the result document result = doc.createElementNS(uri, name); // copy attributes NamedNodeMap srcAttrs = source.getAttributes(); NamedNodeMap dstAttrs = result.getAttributes(); int l = srcAttrs.getLength(); for (int i = 0; i < l; i++) { Node attr = srcAttrs.item(i); if (!Stylesheet.XSL_NS.equals(attr.getNamespaceURI())) { attr = attr.cloneNode(true); attr = doc.adoptNode(attr); dstAttrs.setNamedItemNS(attr); } } } } if (result == null) { // Create result node result = source.cloneNode(false); // Remove any XSL attributes NamedNodeMap attrs = result.getAttributes(); if (attrs != null) { int l = attrs.getLength(); for (int i = 0; i < l; i++) { Node attr = attrs.item(i); if (Stylesheet.XSL_NS.equals(attr.getNamespaceURI())) { attrs.removeNamedItem(attr.getNodeName()); i--; l--; } } } Node result2 = doc.adoptNode(result); if (result2 == null) { String msg = "Error adopting node to result tree: " + result + " (" + result.getClass().getName() + ")"; DOMSourceLocator l = new DOMSourceLocator(context); throw new TransformerException(msg, l); } result = result2; } if (nextSibling != null) { parent.insertBefore(result, nextSibling); } else { parent.appendChild(result); } if (nodeType == Node.ELEMENT_NODE) { stylesheet.addNamespaceNodes(source, result, doc, elementExcludeResultPrefixes); } // children if (children != null) { children.apply(stylesheet, mode, context, pos, len, result, null); } } // next sibling if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
}
void doApply(Stylesheet stylesheet, QName mode, Node context, int pos, int len, Node parent, Node nextSibling) throws TransformerException { Node result = null; Document doc = (parent instanceof Document) ? (Document) parent : parent.getOwnerDocument(); short nodeType = source.getNodeType(); if (nodeType == Node.ATTRIBUTE_NODE && parent.getFirstChild() != null) { // Ignore attributes added after child elements } else { // Namespace aliasing if (nodeType == Node.ELEMENT_NODE) { String prefix = source.getPrefix(); if (prefix == null) { prefix = "#default"; } String resultPrefix = (String) stylesheet.namespaceAliases.get(prefix); if (resultPrefix != null) { if ("#default".equals(resultPrefix)) { resultPrefix = null; } String uri = source.lookupNamespaceURI(resultPrefix); String name = source.getNodeName(); // Create a new element node in the result document result = doc.createElementNS(uri, name); // copy attributes NamedNodeMap srcAttrs = source.getAttributes(); NamedNodeMap dstAttrs = result.getAttributes(); int l = srcAttrs.getLength(); for (int i = 0; i < l; i++) { Node attr = srcAttrs.item(i); if (!Stylesheet.XSL_NS.equals(attr.getNamespaceURI())) { attr = attr.cloneNode(true); attr = doc.adoptNode(attr); dstAttrs.setNamedItemNS(attr); } } } } if (result == null) { // Create result node result = source.cloneNode(false); // Remove any XSL attributes NamedNodeMap attrs = result.getAttributes(); if (attrs != null) { int l = attrs.getLength(); for (int i = 0; i < l; i++) { Node attr = attrs.item(i); if (Stylesheet.XSL_NS.equals(attr.getNamespaceURI())) { attrs.removeNamedItem(attr.getNodeName()); i--; l--; } } } Node result2 = doc.adoptNode(result); if (result2 == null) { String msg = "Error adopting node to result tree: " + result + " (" + result.getClass().getName() + ")"; DOMSourceLocator l = new DOMSourceLocator(context); throw new TransformerException(msg, l); } result = result2; } if (nextSibling != null) { parent.insertBefore(result, nextSibling); } else { parent.appendChild(result); } if (nodeType == Node.ELEMENT_NODE) { stylesheet.addNamespaceNodes(source, result, doc, elementExcludeResultPrefixes); } // children if (children != null) { children.apply(stylesheet, mode, context, pos, len, result, null); } } // next sibling if (next != null) { next.apply(stylesheet, mode, context, pos, len, parent, nextSibling); } }
StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("source="); buf.append(source); buf.append(']'); return buf.toString();
return source.toString();
public String toString() { StringBuffer buf = new StringBuffer(getClass().getName()); buf.append('['); buf.append("source="); buf.append(source); buf.append(']'); return buf.toString(); }
String localName);
String localName) throws DOMException;
public Node getNamedItemNS(String namespaceURI, String localName);
public void setAction(Action a) { action_taken = a; revalidate(); repaint(); }
public void setAction(Action a) { if (action != null) { action.removePropertyChangeListener(actionPropertyChangeListener); removeActionListener(action); if (actionPropertyChangeListener != null) { action.removePropertyChangeListener(actionPropertyChangeListener); actionPropertyChangeListener = null; } actionPropertyChangeListener = createActionPropertyChangeListener(a); } Action old = action; action = a; configurePropertiesFromAction(action); if (action != null) { action.addPropertyChangeListener(actionPropertyChangeListener); addActionListener(action); } }
public void setAction(Action a) { action_taken = a; revalidate(); repaint(); }
public void setModel(ButtonModel newModel) { model = newModel; }
public void setModel(ButtonModel newModel) { if (newModel == model) return; if (model != null) { model.removeActionListener(actionListener); model.removeChangeListener(changeListener); model.removeItemListener(itemListener); } ButtonModel old = model; model = newModel; if (model != null) { model.addActionListener(actionListener); model.addChangeListener(changeListener); model.addItemListener(itemListener); } firePropertyChange(MODEL_CHANGED_PROPERTY, old, model); revalidate(); repaint(); }
public void setModel(ButtonModel newModel) { model = newModel; }
if (comp == rootPane)
if (!initStageDone)
protected void addImpl(Component comp, Object constraints, int index) { // If we're adding the rootPane (initialization stages) use super.add. // otherwise pass the add onto the content pane. if (comp == rootPane) super.addImpl(comp, constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JWindow directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } }
public Window(Window owner, GraphicsConfiguration gc)
Window()
public Window(Window owner, GraphicsConfiguration gc) { this (); synchronized (getTreeLock()) { if (owner == null) throw new IllegalArgumentException ("owner must not be null"); parent = owner; owner.ownedWindows.add(new WeakReference(this)); } // FIXME: make this text visible in the window. SecurityManager s = System.getSecurityManager(); if (s != null && ! s.checkTopLevelWindow(this)) warningString = System.getProperty("awt.appletWarning"); if (gc != null && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) throw new IllegalArgumentException ("gc must be from a screen device"); if (gc == null) graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); else graphicsConfiguration = gc; }
this ();
visible = false; focusCycleRoot = true; setLayout(new BorderLayout());
public Window(Window owner, GraphicsConfiguration gc) { this (); synchronized (getTreeLock()) { if (owner == null) throw new IllegalArgumentException ("owner must not be null"); parent = owner; owner.ownedWindows.add(new WeakReference(this)); } // FIXME: make this text visible in the window. SecurityManager s = System.getSecurityManager(); if (s != null && ! s.checkTopLevelWindow(this)) warningString = System.getProperty("awt.appletWarning"); if (gc != null && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) throw new IllegalArgumentException ("gc must be from a screen device"); if (gc == null) graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); else graphicsConfiguration = gc; }
synchronized (getTreeLock())
addWindowFocusListener (new WindowAdapter ()
public Window(Window owner, GraphicsConfiguration gc) { this (); synchronized (getTreeLock()) { if (owner == null) throw new IllegalArgumentException ("owner must not be null"); parent = owner; owner.ownedWindows.add(new WeakReference(this)); } // FIXME: make this text visible in the window. SecurityManager s = System.getSecurityManager(); if (s != null && ! s.checkTopLevelWindow(this)) warningString = System.getProperty("awt.appletWarning"); if (gc != null && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) throw new IllegalArgumentException ("gc must be from a screen device"); if (gc == null) graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); else graphicsConfiguration = gc; }
if (owner == null) throw new IllegalArgumentException ("owner must not be null"); parent = owner; owner.ownedWindows.add(new WeakReference(this)); } SecurityManager s = System.getSecurityManager(); if (s != null && ! s.checkTopLevelWindow(this)) warningString = System.getProperty("awt.appletWarning"); if (gc != null && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) throw new IllegalArgumentException ("gc must be from a screen device"); if (gc == null) graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); else graphicsConfiguration = gc;
public void windowGainedFocus (WindowEvent event) { if (windowFocusOwner != null) { EventQueue eq = Toolkit.getDefaultToolkit ().getSystemEventQueue (); synchronized (eq) { KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); Component currentFocusOwner = manager.getGlobalPermanentFocusOwner (); if (currentFocusOwner != null) { eq.postEvent (new FocusEvent (currentFocusOwner, FocusEvent.FOCUS_LOST, false, windowFocusOwner)); eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false, currentFocusOwner)); } else eq.postEvent (new FocusEvent (windowFocusOwner, FocusEvent.FOCUS_GAINED, false)); } } } });
public Window(Window owner, GraphicsConfiguration gc) { this (); synchronized (getTreeLock()) { if (owner == null) throw new IllegalArgumentException ("owner must not be null"); parent = owner; owner.ownedWindows.add(new WeakReference(this)); } // FIXME: make this text visible in the window. SecurityManager s = System.getSecurityManager(); if (s != null && ! s.checkTopLevelWindow(this)) warningString = System.getProperty("awt.appletWarning"); if (gc != null && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) throw new IllegalArgumentException ("gc must be from a screen device"); if (gc == null) graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration(); else graphicsConfiguration = gc; }
catch (ClassCastException ex)
} catch (Exception ex)
public Serializable extract_Value() throws BAD_OPERATION { try { return ((ValueBaseHolder) has).value; } catch (ClassCastException ex) { return new BAD_OPERATION("Value type expected"); } }
public ObjectHolder(org.omg.CORBA.Object initial_value)
public ObjectHolder()
public ObjectHolder(org.omg.CORBA.Object initial_value) { value = initial_value; }
value = initial_value;
public ObjectHolder(org.omg.CORBA.Object initial_value) { value = initial_value; }
public TypeCodeHolder(TypeCode initial_value)
public TypeCodeHolder()
public TypeCodeHolder(TypeCode initial_value) { value = initial_value; }
value = initial_value;
public TypeCodeHolder(TypeCode initial_value) { value = initial_value; }
public ValueBaseHolder(Serializable initial)
public ValueBaseHolder()
public ValueBaseHolder(Serializable initial) { value = initial; }
value = initial;
public ValueBaseHolder(Serializable initial) { value = initial; }
public OctetHolder(byte initial_value)
public OctetHolder()
public OctetHolder(byte initial_value) { value = initial_value; }
value = initial_value;
public OctetHolder(byte initial_value) { value = initial_value; }
public ShortHolder(short initial_value)
public ShortHolder()
public ShortHolder(short initial_value) { value = initial_value; }
value = initial_value;
public ShortHolder(short initial_value) { value = initial_value; }
public WCharHolder(char initial_value)
public WCharHolder()
public WCharHolder(char initial_value) { value = initial_value; }
value = initial_value;
public WCharHolder(char initial_value) { value = initial_value; }
public WStringHolder(String initial_value)
public WStringHolder()
public WStringHolder(String initial_value) { value = initial_value; }
value = initial_value;
public WStringHolder(String initial_value) { value = initial_value; }
size.height = fm.getHeight();
size.height = getMaxHeight(tree); size.y = size.height * row;
public Rectangle getNodeDimensions(Object cell, int row, int depth, boolean expanded, Rectangle size) { if (size == null || cell == null) return null; String s = cell.toString(); Font f = tree.getFont(); FontMetrics fm = tree.getToolkit().getFontMetrics(f); if (s != null) { size.x = getRowX(row, depth); size.width = SwingUtilities.computeStringWidth(fm, s); size.height = fm.getHeight(); } return size; }
int row = Math.round(y / getRowHeight());
int row = Math.round(y / getMaxHeight(tree));
public TreePath getClosestPathForLocation(JTree tree, int x, int y) { int row = Math.round(y / getRowHeight()); TreePath path = getPathForRow(tree, row); // no row is visible at this node while (row > 0 && path == null) { --row; path = getPathForRow(tree, row); } return path; }
Rectangle bounds = null;
public Rectangle getPathBounds(JTree tree, TreePath path) { Rectangle bounds = null; int row = -1; Object cell = null; if (path != null) { row = getRowForPath(tree, path); cell = path.getLastPathComponent(); bounds = new Rectangle(0, row * getRowHeight(), 0, 0); } return nodeDimensions.getNodeDimensions(cell, row, getLevel(cell), tree.isExpanded(path), bounds); }
bounds = new Rectangle(0, row * getRowHeight(), 0, 0);
public Rectangle getPathBounds(JTree tree, TreePath path) { Rectangle bounds = null; int row = -1; Object cell = null; if (path != null) { row = getRowForPath(tree, path); cell = path.getLastPathComponent(); bounds = new Rectangle(0, row * getRowHeight(), 0, 0); } return nodeDimensions.getNodeDimensions(cell, row, getLevel(cell), tree.isExpanded(path), bounds); }
bounds);
new Rectangle());
public Rectangle getPathBounds(JTree tree, TreePath path) { Rectangle bounds = null; int row = -1; Object cell = null; if (path != null) { row = getRowForPath(tree, path); cell = path.getLastPathComponent(); bounds = new Rectangle(0, row * getRowHeight(), 0, 0); } return nodeDimensions.getNodeDimensions(cell, row, getLevel(cell), tree.isExpanded(path), bounds); }
TreeModel mod = tree.getModel(); setModel(mod); if (mod != null) { Object root = mod.getRoot(); if (root != null) { TreePath path = new TreePath(root); if (!tree.isExpanded(path)) toggleExpandState(path); } }
setModel(tree.getModel());
public void installUI(JComponent c) { tree = (JTree) c; prepareForUIInstall(); super.installUI(c); installDefaults(); installComponents(); installKeyboardActions(); installListeners(); setCellEditor(createDefaultCellEditor()); createdCellEditor = true; isEditing = false; TreeModel mod = tree.getModel(); setModel(mod); if (mod != null) { Object root = mod.getRoot(); if (root != null) { TreePath path = new TreePath(root); if (!tree.isExpanded(path)) toggleExpandState(path); } } treeSelectionModel = tree.getSelectionModel(); completeUIInstall(); }
rowHeight = this.rowHeight;
rowHeight = Math.max(getMaxHeight(tree), 20);
protected void setRowHeight(int rowHeight) { if (rowHeight == 0) rowHeight = this.rowHeight; treeState.setRowHeight(rowHeight); }
preferredSize = new Dimension(maxWidth, (getRowHeight() * path.length));
maxHeight = 0; maxHeight = getMaxHeight(tree); preferredSize = new Dimension(maxWidth, (maxHeight * path.length));
protected void updateCachedPreferredSize() { int maxWidth = 0; boolean isLeaf = false; if (currentVisiblePath != null) { Object[] path = currentVisiblePath.getPath(); for (int i = 0; i < path.length; i++) { TreePath curr = new TreePath(getPathToRoot(path[i], 0)); Rectangle bounds = getPathBounds(tree, curr); if (treeModel != null) isLeaf = treeModel.isLeaf(path[i]); if (!isLeaf && hasControlIcons()) bounds.width += getCurrentControlIcon(curr).getIconWidth(); maxWidth = Math.max(maxWidth, bounds.x + bounds.width); } preferredSize = new Dimension(maxWidth, (getRowHeight() * path.length)); } else preferredSize = new Dimension(0, 0); validCachedPreferredSize = true; }
public Object getCellEditorValue();
Object getCellEditorValue();
public Object getCellEditorValue();
public void cancelCellEditing();
void cancelCellEditing();
public void cancelCellEditing();
public boolean stopCellEditing();
boolean stopCellEditing();
public boolean stopCellEditing();
public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1, TreeCellEditor value2) {
public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1) {
public DefaultTreeCellEditor(JTree value0, DefaultTreeCellRenderer value1, TreeCellEditor value2) { // TODO } // DefaultTreeCellEditor()
Container p, Rectangle r) {
Container p, int x, int y, int w, int h, boolean shouldValidate) {
public void paintComponent(Graphics graphics, Component c, Container p, Rectangle r) { // TODO } // paintComponent()
public boolean shouldSelectCell(EventObject event);
boolean shouldSelectCell(EventObject event);
public boolean shouldSelectCell(EventObject event);
public boolean isCellEditable(EventObject event);
boolean isCellEditable(EventObject event);
public boolean isCellEditable(EventObject event);
public abstract int selectionForKey(char value0, ComboBoxModel value1);
int selectionForKey(char value0, ComboBoxModel value1);
public abstract int selectionForKey(char value0, ComboBoxModel value1);
public void addActionListener(ActionListener value0) { }
public void addActionListener (ActionListener listener) { listenerList.add (ActionListener.class, listener); }
public void addActionListener(ActionListener value0) { // TODO } // addActionListener()
public void removeActionListener(ActionListener value0) { }
public void removeActionListener (ActionListener listener) { listenerList.remove (ActionListener.class, listener); }
public void removeActionListener(ActionListener value0) { // TODO } // removeActionListener()
public int getColumnIndexAtX(int xPosition);
int getColumnIndexAtX(int xPosition);
public int getColumnIndexAtX(int xPosition);
public Enumeration getColumns();
Enumeration getColumns();
public Enumeration getColumns();
public int getSelectedColumnCount();
int getSelectedColumnCount();
public int getSelectedColumnCount();
public int[] getSelectedColumns();
int[] getSelectedColumns();
public int[] getSelectedColumns();
public void setSelectionModel(ListSelectionModel model);
void setSelectionModel(ListSelectionModel model);
public void setSelectionModel(ListSelectionModel model);
if (interrupted)
if (interrupted || len < 1)
public void characters(char[] c, int off, int len) throws SAXException { if (interrupted) { return; } ctx.appendChild(createText(c, off, len)); }
if (!inDTD) {
public void comment(char[] c, int off, int len) throws SAXException { if (interrupted) { return; } if (!inDTD) { Node comment = createComment(c, off, len); ctx.appendChild(comment); } }
}
public void comment(char[] c, int off, int len) throws SAXException { if (interrupted) { return; } if (!inDTD) { Node comment = createComment(c, off, len); ctx.appendChild(comment); } }
if (!inDTD) {
public void processingInstruction(String target, String data) throws SAXException { if (interrupted) { return; } if (!inDTD) { Node pi = createProcessingInstruction(target, data); ctx.appendChild(pi); } }
}
public void processingInstruction(String target, String data) throws SAXException { if (interrupted) { return; } if (!inDTD) { Node pi = createProcessingInstruction(target, data); ctx.appendChild(pi); } }
final String FEATURES = "http: final String PROPERTIES = "http: final String GNU_PROPERTIES = "http: boolean standalone = reader.getFeature(FEATURES + "is-standalone"); doc.setXmlStandalone(standalone); try { String version = (String) reader.getProperty(PROPERTIES + "document-xml-version"); doc.setXmlVersion(version); } catch (SAXNotRecognizedException e) { } catch (SAXNotSupportedException e) { } if (locator != null && locator instanceof Locator2) { String encoding = ((Locator2) locator).getEncoding(); doc.setInputEncoding(encoding); } try { String encoding = (String) reader.getProperty(GNU_PROPERTIES + "document-xml-encoding"); doc.setXmlEncoding(encoding); } catch (SAXNotRecognizedException e) { } catch (SAXNotSupportedException e) { }
public void startDocument() throws SAXException { if (namespaceAware) { pending = new LinkedList(); } doc = new DomDocument(); doc.setStrictErrorChecking(false); doc.setBuilding(true); ctx = doc; }
synchronized (cal) { cal.setTime(new Date(time * 1000L)); dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25 | (cal.get(Calendar.MONTH) + 1) << 21 | (cal.get(Calendar.DAY_OF_MONTH)) << 16 | (cal.get(Calendar.HOUR_OF_DAY)) << 11 | (cal.get(Calendar.MINUTE)) << 5 | (cal.get(Calendar.SECOND)) >> 1;
synchronized (cal) { cal.setTime(new Date(time)); dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25 | (cal.get(Calendar.MONTH) + 1) << 21 | (cal.get(Calendar.DAY_OF_MONTH)) << 16 | (cal.get(Calendar.HOUR_OF_DAY)) << 11 | (cal.get(Calendar.MINUTE)) << 5 | (cal.get(Calendar.SECOND)) >> 1;
public void setTime(long time) { Calendar cal = getCalendar(); synchronized (cal) { cal.setTime(new Date(time * 1000L)); dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25 | (cal.get(Calendar.MONTH) + 1) << 21 | (cal.get(Calendar.DAY_OF_MONTH)) << 16 | (cal.get(Calendar.HOUR_OF_DAY)) << 11 | (cal.get(Calendar.MINUTE)) << 5 | (cal.get(Calendar.SECOND)) >> 1; } dostime = (int) (dostime / 1000L); this.known |= KNOWN_TIME; }
dostime = (int) (dostime / 1000L);
public void setTime(long time) { Calendar cal = getCalendar(); synchronized (cal) { cal.setTime(new Date(time * 1000L)); dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25 | (cal.get(Calendar.MONTH) + 1) << 21 | (cal.get(Calendar.DAY_OF_MONTH)) << 16 | (cal.get(Calendar.HOUR_OF_DAY)) << 11 | (cal.get(Calendar.MINUTE)) << 5 | (cal.get(Calendar.SECOND)) >> 1; } dostime = (int) (dostime / 1000L); this.known |= KNOWN_TIME; }
io.unlock();
public void restoreToVGA(VgaIO vgaIO) { final NVidiaVgaIO io = (NVidiaVgaIO) vgaIO; super.restoreToVGA(io); io.unlock(); if (loaded) { io.setReg32(NV32_PWRUPCTRL, pwupctrl); io.setFB(0x200, config); io.setReg32(NVDAC_CURPOS, cursor2); io.setReg32(NVDAC_PIXPLLC, vpll); io.setReg32(NVDAC_PLLSEL, pllsel); io.setReg32(NVDAC_GENCTRL, general); io.setReg32(NV_PGRAPH_BOFFSET0, offset); io.setReg32(NV_PGRAPH_BOFFSET1, offset); io.setReg32(NV_PGRAPH_BOFFSET2, offset); io.setReg32(NV_PGRAPH_BOFFSET3, offset); io.setReg32(NV_PGRAPH_BPITCH0, pitch); io.setReg32(NV_PGRAPH_BPITCH1, pitch); io.setReg32(NV_PGRAPH_BPITCH2, pitch); io.setReg32(NV_PGRAPH_BPITCH3, pitch); } }
log.debug("size=" + size + ", pal.mapsize=" + palette.getMapSize());
protected void restorePalette(VgaIO io) { if (palette != null) { final int size = Math.min(256, palette.getMapSize()); final byte[] r = new byte[size]; final byte[] g = new byte[size]; final byte[] b = new byte[size]; palette.getReds(r); palette.getGreens(g); palette.getBlues(b); //log.debug("Restore-Size:" + size + ", R=" + NumberUtils.hex(r)); for (int i = size - 1; i >= 0; i--) { setPaletteEntry(io, i, r[i] & 0xff, g[i] & 0xff, b[i] & 0xff); } } }
palette = new IndexColorModel(32, size, r, g, b);
palette = new IndexColorModel(8/*32*
protected void savePalette(VgaIO io) { final int size = getPaletteSize(io); final byte[] r = new byte[size]; final byte[] g = new byte[size]; final byte[] b = new byte[size]; for (int i = size - 1; i >= 0; i--) { getPaletteEntry(io, i, r, g, b); } //log.debug("Save-Size:" + size + ", R=" + NumberUtils.hex(r)); palette = new IndexColorModel(32/*6*/, size, r, g, b); }
private void moveDividerTo(int locationIndex)
void moveDividerTo(int locationIndex)
private void moveDividerTo(int locationIndex) { Insets insets = splitPane.getInsets(); switch (locationIndex) { case 1: splitPane.setDividerLocation(splitPane.getLastDividerLocation()); break; case 0: int top = (orientation == JSplitPane.HORIZONTAL_SPLIT) ? insets.left : insets.top; splitPane.setDividerLocation(top); break; case 2: int bottom; if (orientation == JSplitPane.HORIZONTAL_SPLIT) bottom = splitPane.getBounds().width - insets.right - dividerSize; else bottom = splitPane.getBounds().height - insets.bottom - dividerSize; splitPane.setDividerLocation(bottom); break; } }
public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException {
public IndexedPropertyDescriptor(String name, Class beanClass) throws IntrospectionException {
public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException { super(name); if(getMethod != null && getMethod.getParameterTypes().length > 0) { throw new IntrospectionException("get method has parameters"); } if(getMethod != null && setMethod.getParameterTypes().length != 1) { throw new IntrospectionException("set method does not have exactly one parameter"); } if(getMethod != null && setMethod != null) { if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0])) { throw new IntrospectionException("set and get methods do not share the same type"); } if(!getMethod.getDeclaringClass().isAssignableFrom(setMethod.getDeclaringClass()) && !setMethod.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())) { throw new IntrospectionException("set and get methods are not in the same class."); } } if(getIndex != null && (getIndex.getParameterTypes().length != 1 || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("get index method has wrong parameters"); } if(setIndex != null && (setIndex.getParameterTypes().length != 2 || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("set index method has wrong parameters"); } if(getIndex != null && setIndex != null) { if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1])) { throw new IntrospectionException("set index methods do not share the same type"); } if(!getIndex.getDeclaringClass().isAssignableFrom(setIndex.getDeclaringClass()) && !setIndex.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("get and set index methods are not in the same class."); } } if(getIndex != null && getMethod != null && !getIndex.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass()) && !getMethod.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("methods are not in the same class."); } if(getIndex != null && getMethod != null && !Array.newInstance(getIndex.getReturnType(),0).getClass().equals(getMethod.getReturnType())) { throw new IntrospectionException("array methods do not match index methods."); } this.getMethod = getMethod; this.setMethod = setMethod; this.getIndex = getIndex; this.setIndex = setIndex; this.indexedPropertyType = getIndex != null ? getIndex.getReturnType() : setIndex.getParameterTypes()[1]; this.propertyType = getMethod != null ? getMethod.getReturnType() : (setMethod != null ? setMethod.getParameterTypes()[0] : Array.newInstance(this.indexedPropertyType,0).getClass()); }
if(getMethod != null && getMethod.getParameterTypes().length > 0) { throw new IntrospectionException("get method has parameters");
String capitalized; try { capitalized = Character.toUpperCase(name.charAt(0)) + name.substring(1); } catch(StringIndexOutOfBoundsException e) { capitalized = "";
public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException { super(name); if(getMethod != null && getMethod.getParameterTypes().length > 0) { throw new IntrospectionException("get method has parameters"); } if(getMethod != null && setMethod.getParameterTypes().length != 1) { throw new IntrospectionException("set method does not have exactly one parameter"); } if(getMethod != null && setMethod != null) { if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0])) { throw new IntrospectionException("set and get methods do not share the same type"); } if(!getMethod.getDeclaringClass().isAssignableFrom(setMethod.getDeclaringClass()) && !setMethod.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())) { throw new IntrospectionException("set and get methods are not in the same class."); } } if(getIndex != null && (getIndex.getParameterTypes().length != 1 || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("get index method has wrong parameters"); } if(setIndex != null && (setIndex.getParameterTypes().length != 2 || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("set index method has wrong parameters"); } if(getIndex != null && setIndex != null) { if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1])) { throw new IntrospectionException("set index methods do not share the same type"); } if(!getIndex.getDeclaringClass().isAssignableFrom(setIndex.getDeclaringClass()) && !setIndex.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("get and set index methods are not in the same class."); } } if(getIndex != null && getMethod != null && !getIndex.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass()) && !getMethod.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("methods are not in the same class."); } if(getIndex != null && getMethod != null && !Array.newInstance(getIndex.getReturnType(),0).getClass().equals(getMethod.getReturnType())) { throw new IntrospectionException("array methods do not match index methods."); } this.getMethod = getMethod; this.setMethod = setMethod; this.getIndex = getIndex; this.setIndex = setIndex; this.indexedPropertyType = getIndex != null ? getIndex.getReturnType() : setIndex.getParameterTypes()[1]; this.propertyType = getMethod != null ? getMethod.getReturnType() : (setMethod != null ? setMethod.getParameterTypes()[0] : Array.newInstance(this.indexedPropertyType,0).getClass()); }
if(getMethod != null && setMethod.getParameterTypes().length != 1) { throw new IntrospectionException("set method does not have exactly one parameter"); } if(getMethod != null && setMethod != null) { if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0])) { throw new IntrospectionException("set and get methods do not share the same type"); } if(!getMethod.getDeclaringClass().isAssignableFrom(setMethod.getDeclaringClass()) && !setMethod.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())) { throw new IntrospectionException("set and get methods are not in the same class."); } } if(getIndex != null && (getIndex.getParameterTypes().length != 1 || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("get index method has wrong parameters"); } if(setIndex != null && (setIndex.getParameterTypes().length != 2 || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("set index method has wrong parameters"); } if(getIndex != null && setIndex != null) { if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1])) { throw new IntrospectionException("set index methods do not share the same type"); } if(!getIndex.getDeclaringClass().isAssignableFrom(setIndex.getDeclaringClass()) && !setIndex.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("get and set index methods are not in the same class."); } } if(getIndex != null && getMethod != null && !getIndex.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass()) && !getMethod.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("methods are not in the same class."); } if(getIndex != null && getMethod != null && !Array.newInstance(getIndex.getReturnType(),0).getClass().equals(getMethod.getReturnType())) { throw new IntrospectionException("array methods do not match index methods."); } this.getMethod = getMethod; this.setMethod = setMethod; this.getIndex = getIndex; this.setIndex = setIndex; this.indexedPropertyType = getIndex != null ? getIndex.getReturnType() : setIndex.getParameterTypes()[1]; this.propertyType = getMethod != null ? getMethod.getReturnType() : (setMethod != null ? setMethod.getParameterTypes()[0] : Array.newInstance(this.indexedPropertyType,0).getClass());
findMethods(beanClass, "get" + capitalized, "set" + capitalized, "get" + capitalized, "set" + capitalized);
public IndexedPropertyDescriptor(String name, Method getMethod, Method setMethod, Method getIndex, Method setIndex) throws IntrospectionException { super(name); if(getMethod != null && getMethod.getParameterTypes().length > 0) { throw new IntrospectionException("get method has parameters"); } if(getMethod != null && setMethod.getParameterTypes().length != 1) { throw new IntrospectionException("set method does not have exactly one parameter"); } if(getMethod != null && setMethod != null) { if(!getMethod.getReturnType().equals(setMethod.getParameterTypes()[0])) { throw new IntrospectionException("set and get methods do not share the same type"); } if(!getMethod.getDeclaringClass().isAssignableFrom(setMethod.getDeclaringClass()) && !setMethod.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass())) { throw new IntrospectionException("set and get methods are not in the same class."); } } if(getIndex != null && (getIndex.getParameterTypes().length != 1 || !(getIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("get index method has wrong parameters"); } if(setIndex != null && (setIndex.getParameterTypes().length != 2 || !(setIndex.getParameterTypes()[0]).equals(java.lang.Integer.TYPE))) { throw new IntrospectionException("set index method has wrong parameters"); } if(getIndex != null && setIndex != null) { if(!getIndex.getReturnType().equals(setIndex.getParameterTypes()[1])) { throw new IntrospectionException("set index methods do not share the same type"); } if(!getIndex.getDeclaringClass().isAssignableFrom(setIndex.getDeclaringClass()) && !setIndex.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("get and set index methods are not in the same class."); } } if(getIndex != null && getMethod != null && !getIndex.getDeclaringClass().isAssignableFrom(getMethod.getDeclaringClass()) && !getMethod.getDeclaringClass().isAssignableFrom(getIndex.getDeclaringClass())) { throw new IntrospectionException("methods are not in the same class."); } if(getIndex != null && getMethod != null && !Array.newInstance(getIndex.getReturnType(),0).getClass().equals(getMethod.getReturnType())) { throw new IntrospectionException("array methods do not match index methods."); } this.getMethod = getMethod; this.setMethod = setMethod; this.getIndex = getIndex; this.setIndex = setIndex; this.indexedPropertyType = getIndex != null ? getIndex.getReturnType() : setIndex.getParameterTypes()[1]; this.propertyType = getMethod != null ? getMethod.getReturnType() : (setMethod != null ? setMethod.getParameterTypes()[0] : Array.newInstance(this.indexedPropertyType,0).getClass()); }
public ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException
ServerSocket(SocketImpl impl) throws IOException
public ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException { this(); // bind/listen socket bind(new InetSocketAddress(bindAddr, port), backlog); }
this();
if (impl == null) throw new NullPointerException("impl may not be null");
public ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException { this(); // bind/listen socket bind(new InetSocketAddress(bindAddr, port), backlog); }
bind(new InetSocketAddress(bindAddr, port), backlog);
this.impl = impl; this.impl.create(true);
public ServerSocket(int port, int backlog, InetAddress bindAddr) throws IOException { this(); // bind/listen socket bind(new InetSocketAddress(bindAddr, port), backlog); }
}
private void parse(InputStream encoded) throws Exception { DERReader der = new DERReader(encoded); // Certificate ::= SEQUENCE { DERValue cert = der.read(); debug("start Certificate len == " + cert.getLength()); this.encoded = cert.getEncoded(); if (!cert.isConstructed()) { throw new IOException("malformed Certificate"); } // TBSCertificate ::= SEQUENCE { DERValue tbsCert = der.read(); if (tbsCert.getValue() != DER.CONSTRUCTED_VALUE) { throw new IOException("malformed TBSCertificate"); } tbsCertBytes = tbsCert.getEncoded(); debug("start TBSCertificate len == " + tbsCert.getLength()); // Version ::= INTEGER [0] { v1(0), v2(1), v3(2) } DERValue val = der.read(); if (val.getTagClass() == DER.CONTEXT && val.getTag() == 0) { version = ((BigInteger) der.read().getValue()).intValue() + 1; val = der.read(); } else { version = 1; } debug("read version == " + version); // SerialNumber ::= INTEGER serialNo = (BigInteger) val.getValue(); debug("read serial number == " + serialNo); // AlgorithmIdentifier ::= SEQUENCE { val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); } int certAlgLen = val.getLength(); debug("start AlgorithmIdentifier len == " + certAlgLen); val = der.read(); // algorithm OBJECT IDENTIFIER, algId = (OID) val.getValue(); debug("read algorithm ID == " + algId); // parameters ANY DEFINED BY algorithm OPTIONAL } if (certAlgLen > val.getEncodedLength()) { val = der.read(); if (val == null) { algVal = null; } else { algVal = val.getEncoded(); } if (val.isConstructed()) { encoded.skip(val.getLength()); } debug("read algorithm parameters == " + algVal); } // issuer Name, val = der.read(); issuer = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); debug("read issuer == " + issuer); // Validity ::= SEQUENCE { // notBefore Time, // notAfter Time } if (!der.read().isConstructed()) { throw new IOException("malformed Validity"); } notBefore = (Date) der.read().getValue(); notAfter = (Date) der.read().getValue(); debug("read notBefore == " + notBefore); debug("read notAfter == " + notAfter); // subject Name, val = der.read(); subject = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); debug("read subject == " + subject); // SubjectPublicKeyInfo ::= SEQUENCE { // algorithm AlgorithmIdentifier, // subjectPublicKey BIT STRING } DERValue spki = der.read(); if (!spki.isConstructed()) { throw new IOException("malformed SubjectPublicKeyInfo"); } KeyFactory spkFac = KeyFactory.getInstance("X.509"); subjectKey = spkFac.generatePublic(new X509EncodedKeySpec(spki.getEncoded())); der.skip(spki.getLength()); debug("read subjectPublicKey == " + subjectKey); if (version > 1) { val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 1) { byte[] b = (byte[]) val.getValue(); issuerUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); debug("read issuerUniqueId == " + issuerUniqueId); val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 2) { byte[] b = (byte[]) val.getValue(); subjectUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); debug("read subjectUniqueId == " + subjectUniqueId); val = der.read(); } if (version >= 3 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 3) { val = der.read(); debug("start Extensions len == " + val.getLength()); int len = 0; while (len < val.getLength()) { DERValue ext = der.read(); debug("start extension len == " + ext.getLength()); Extension e = new Extension(ext.getEncoded()); extensions.put(e.getOid(), e); der.skip(ext.getLength()); len += ext.getEncodedLength(); debug("count == " + len); } } val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); } int sigAlgLen = val.getLength(); debug("start AlgorithmIdentifier len == " + sigAlgLen); val = der.read(); sigAlgId = (OID) val.getValue(); debug("read algorithm id == " + sigAlgId); if (sigAlgLen > val.getEncodedLength()) { val = der.read(); if (val.getValue() == null) { if (subjectKey instanceof DSAPublicKey) { AlgorithmParameters params = AlgorithmParameters.getInstance("DSA"); DSAParams dsap = ((DSAPublicKey) subjectKey).getParams(); DSAParameterSpec spec = new DSAParameterSpec(dsap.getP(), dsap.getQ(), dsap.getG()); params.init(spec); sigAlgVal = params.getEncoded(); } } else { sigAlgVal = (byte[]) val.getEncoded(); } if (val.isConstructed()) { encoded.skip(val.getLength()); } debug("read parameters == " + sigAlgVal); } signature = ((BitString) der.read().getValue()).toByteArray(); debug("read signature ==\n" + Util.hexDump(signature, ">>>> ")); }
{
private void parse(InputStream encoded) throws Exception { DERReader der = new DERReader(encoded); // Certificate ::= SEQUENCE { DERValue cert = der.read(); debug("start Certificate len == " + cert.getLength()); this.encoded = cert.getEncoded(); if (!cert.isConstructed()) { throw new IOException("malformed Certificate"); } // TBSCertificate ::= SEQUENCE { DERValue tbsCert = der.read(); if (tbsCert.getValue() != DER.CONSTRUCTED_VALUE) { throw new IOException("malformed TBSCertificate"); } tbsCertBytes = tbsCert.getEncoded(); debug("start TBSCertificate len == " + tbsCert.getLength()); // Version ::= INTEGER [0] { v1(0), v2(1), v3(2) } DERValue val = der.read(); if (val.getTagClass() == DER.CONTEXT && val.getTag() == 0) { version = ((BigInteger) der.read().getValue()).intValue() + 1; val = der.read(); } else { version = 1; } debug("read version == " + version); // SerialNumber ::= INTEGER serialNo = (BigInteger) val.getValue(); debug("read serial number == " + serialNo); // AlgorithmIdentifier ::= SEQUENCE { val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); } int certAlgLen = val.getLength(); debug("start AlgorithmIdentifier len == " + certAlgLen); val = der.read(); // algorithm OBJECT IDENTIFIER, algId = (OID) val.getValue(); debug("read algorithm ID == " + algId); // parameters ANY DEFINED BY algorithm OPTIONAL } if (certAlgLen > val.getEncodedLength()) { val = der.read(); if (val == null) { algVal = null; } else { algVal = val.getEncoded(); } if (val.isConstructed()) { encoded.skip(val.getLength()); } debug("read algorithm parameters == " + algVal); } // issuer Name, val = der.read(); issuer = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); debug("read issuer == " + issuer); // Validity ::= SEQUENCE { // notBefore Time, // notAfter Time } if (!der.read().isConstructed()) { throw new IOException("malformed Validity"); } notBefore = (Date) der.read().getValue(); notAfter = (Date) der.read().getValue(); debug("read notBefore == " + notBefore); debug("read notAfter == " + notAfter); // subject Name, val = der.read(); subject = new X500DistinguishedName(val.getEncoded()); der.skip(val.getLength()); debug("read subject == " + subject); // SubjectPublicKeyInfo ::= SEQUENCE { // algorithm AlgorithmIdentifier, // subjectPublicKey BIT STRING } DERValue spki = der.read(); if (!spki.isConstructed()) { throw new IOException("malformed SubjectPublicKeyInfo"); } KeyFactory spkFac = KeyFactory.getInstance("X.509"); subjectKey = spkFac.generatePublic(new X509EncodedKeySpec(spki.getEncoded())); der.skip(spki.getLength()); debug("read subjectPublicKey == " + subjectKey); if (version > 1) { val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 1) { byte[] b = (byte[]) val.getValue(); issuerUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); debug("read issuerUniqueId == " + issuerUniqueId); val = der.read(); } if (version >= 2 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 2) { byte[] b = (byte[]) val.getValue(); subjectUniqueId = new BitString(b, 1, b.length-1, b[0] & 0xFF); debug("read subjectUniqueId == " + subjectUniqueId); val = der.read(); } if (version >= 3 && val.getTagClass() != DER.UNIVERSAL && val.getTag() == 3) { val = der.read(); debug("start Extensions len == " + val.getLength()); int len = 0; while (len < val.getLength()) { DERValue ext = der.read(); debug("start extension len == " + ext.getLength()); Extension e = new Extension(ext.getEncoded()); extensions.put(e.getOid(), e); der.skip(ext.getLength()); len += ext.getEncodedLength(); debug("count == " + len); } } val = der.read(); if (!val.isConstructed()) { throw new IOException("malformed AlgorithmIdentifier"); } int sigAlgLen = val.getLength(); debug("start AlgorithmIdentifier len == " + sigAlgLen); val = der.read(); sigAlgId = (OID) val.getValue(); debug("read algorithm id == " + sigAlgId); if (sigAlgLen > val.getEncodedLength()) { val = der.read(); if (val.getValue() == null) { if (subjectKey instanceof DSAPublicKey) { AlgorithmParameters params = AlgorithmParameters.getInstance("DSA"); DSAParams dsap = ((DSAPublicKey) subjectKey).getParams(); DSAParameterSpec spec = new DSAParameterSpec(dsap.getP(), dsap.getQ(), dsap.getG()); params.init(spec); sigAlgVal = params.getEncoded(); } } else { sigAlgVal = (byte[]) val.getEncoded(); } if (val.isConstructed()) { encoded.skip(val.getLength()); } debug("read parameters == " + sigAlgVal); } signature = ((BitString) der.read().getValue()).toByteArray(); debug("read signature ==\n" + Util.hexDump(signature, ">>>> ")); }
public final void update(byte[]data) throws SignatureException
public final void update(byte b) throws SignatureException
public final void update(byte[]data) throws SignatureException { if (state != UNINITIALIZED) engineUpdate(data, 0, data.length); else throw new SignatureException(); }
engineUpdate(data, 0, data.length);
engineUpdate(b);
public final void update(byte[]data) throws SignatureException { if (state != UNINITIALIZED) engineUpdate(data, 0, data.length); else throw new SignatureException(); }
public Set getCriticalExtensionOIDs();
Set getCriticalExtensionOIDs();
public Set getCriticalExtensionOIDs();
public byte[] getExtensionValue(String oid);
byte[] getExtensionValue(String oid);
public byte[] getExtensionValue(String oid);
public X500Principal(byte[] encoded)
public X500Principal(String name)
public X500Principal(byte[] encoded) { try { name = new X500DistinguishedName(encoded); } catch (IOException ioe) { throw new IllegalArgumentException(ioe.toString()); } }
try { name = new X500DistinguishedName(encoded); } catch (IOException ioe) { throw new IllegalArgumentException(ioe.toString()); }
if (name == null) throw new NullPointerException(); this.name = new X500DistinguishedName(name);
public X500Principal(byte[] encoded) { try { name = new X500DistinguishedName(encoded); } catch (IOException ioe) { throw new IllegalArgumentException(ioe.toString()); } }
public Set getNonCriticalExtensionOIDs();
Set getNonCriticalExtensionOIDs();
public Set getNonCriticalExtensionOIDs();
public boolean hasUnsupportedCriticalExtension();
boolean hasUnsupportedCriticalExtension();
public boolean hasUnsupportedCriticalExtension();
catch (NoSuchAlgorithmException ignored) {}
catch (NoSuchAlgorithmException e) { }
public static KeyFactory getInstance(String algorithm) throws NoSuchAlgorithmException { Provider[] p = Security.getProviders(); for (int i = 0; i < p.length; i++) try { return getInstance(algorithm, p[i]); } catch (NoSuchAlgorithmException ignored) {} throw new NoSuchAlgorithmException(algorithm); }
catch (NoSuchAlgorithmException ignored) {}
catch (NoSuchAlgorithmException e) { }
public static AlgorithmParameters getInstance(String algorithm) throws NoSuchAlgorithmException { Provider[] p = Security.getProviders(); for (int i = 0; i < p.length; i++) try { return getInstance(algorithm, p[i]); } catch (NoSuchAlgorithmException ignored) {} throw new NoSuchAlgorithmException(algorithm); }
CollationElement(String char_seq, int primary, short secondary, short tertiary) { this.char_seq = char_seq;
CollationElement(String key, int primary, short secondary, short tertiary, short equality, String expansion, boolean ignore) { this.key = key;
CollationElement(String char_seq, int primary, short secondary, short tertiary){ this.char_seq = char_seq; this.primary = primary; this.secondary = secondary; this.tertiary = tertiary;}
}
this.equality = equality; this.ignore = ignore; this.expansion = expansion; }
CollationElement(String char_seq, int primary, short secondary, short tertiary){ this.char_seq = char_seq; this.primary = primary; this.secondary = secondary; this.tertiary = tertiary;}
RuleBasedCollator(String rules) throws ParseException {
public RuleBasedCollator(String rules) throws ParseException { if (rules.equals("")) throw new ParseException("empty rule set", 0);
RuleBasedCollator(String rules) throws ParseException{ this.rules = rules; if (rules.equals("")) throw new IllegalArgumentException("Empty rule set"); Vector v = new Vector(); boolean ignore_chars = true; int primary_seq = 0; short secondary_seq = 0; short tertiary_seq = 0; StringBuffer sb = new StringBuffer(""); for (int i = 0; i < rules.length(); i++) { char c = rules.charAt(i); // Check if it is a whitespace character if (((c >= 0x09) && (c <= 0x0D)) || (c == 0x20)) continue; // Primary difference if (c == '<') { ignore_chars = false; secondary_seq = 0; tertiary_seq = 0; ++primary_seq; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Secondary difference if (c == ';') { if (primary_seq == 0) throw new ParseException(rules, i); ++secondary_seq; tertiary_seq = 0; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Tertiary difference if (c == ',') { if (primary_seq == 0) throw new ParseException(rules, i); ++tertiary_seq; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Is equal to if (c == '=') { if (primary_seq == 0) throw new ParseException(rules, i); CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Sort accents backwards if (c == '@') { throw new ParseException("French style accents not implemented yet", 0); } // Reset command if (c == '&') { throw new ParseException("Reset not implemented yet", 0); } // See if we are still reading characters to skip if (ignore_chars == true) { CollationElement e = new CollationElement(c + "", 0, (short)0, (short)0); v.add(e); continue; } sb.append(c); } ce_table = v.toArray();}
if (rules.equals("")) throw new IllegalArgumentException("Empty rule set"); Vector v = new Vector(); boolean ignore_chars = true; int primary_seq = 0; short secondary_seq = 0; short tertiary_seq = 0; StringBuffer sb = new StringBuffer(""); for (int i = 0; i < rules.length(); i++) { char c = rules.charAt(i); if (((c >= 0x09) && (c <= 0x0D)) || (c == 0x20)) continue; if (c == '<') { ignore_chars = false; secondary_seq = 0; tertiary_seq = 0; ++primary_seq; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } if (c == ';') { if (primary_seq == 0) throw new ParseException(rules, i); ++secondary_seq; tertiary_seq = 0; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } if (c == ',') { if (primary_seq == 0) throw new ParseException(rules, i); ++tertiary_seq; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } if (c == '=') { if (primary_seq == 0) throw new ParseException(rules, i); CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } if (c == '@') { throw new ParseException("French style accents not implemented yet", 0); } if (c == '&') { throw new ParseException("Reset not implemented yet", 0); } if (ignore_chars == true) { CollationElement e = new CollationElement(c + "", 0, (short)0, (short)0); v.add(e); continue; } sb.append(c); } ce_table = v.toArray(); }
buildCollationVector(parseString(rules)); buildPrefixAccess(); }
RuleBasedCollator(String rules) throws ParseException{ this.rules = rules; if (rules.equals("")) throw new IllegalArgumentException("Empty rule set"); Vector v = new Vector(); boolean ignore_chars = true; int primary_seq = 0; short secondary_seq = 0; short tertiary_seq = 0; StringBuffer sb = new StringBuffer(""); for (int i = 0; i < rules.length(); i++) { char c = rules.charAt(i); // Check if it is a whitespace character if (((c >= 0x09) && (c <= 0x0D)) || (c == 0x20)) continue; // Primary difference if (c == '<') { ignore_chars = false; secondary_seq = 0; tertiary_seq = 0; ++primary_seq; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Secondary difference if (c == ';') { if (primary_seq == 0) throw new ParseException(rules, i); ++secondary_seq; tertiary_seq = 0; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Tertiary difference if (c == ',') { if (primary_seq == 0) throw new ParseException(rules, i); ++tertiary_seq; CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Is equal to if (c == '=') { if (primary_seq == 0) throw new ParseException(rules, i); CollationElement e = new CollationElement(sb.toString(), primary_seq, secondary_seq, tertiary_seq); v.add(e); sb.setLength(0); continue; } // Sort accents backwards if (c == '@') { throw new ParseException("French style accents not implemented yet", 0); } // Reset command if (c == '&') { throw new ParseException("Reset not implemented yet", 0); } // See if we are still reading characters to skip if (ignore_chars == true) { CollationElement e = new CollationElement(c + "", 0, (short)0, (short)0); v.add(e); continue; } sb.append(c); } ce_table = v.toArray();}
clone() { return super.clone(); }
public Object clone() { return super.clone(); }
clone(){ return super.clone();}
compare(String s1, String s2) { CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2);
public int compare(String source, String target) { CollationElementIterator cs, ct; CollationElement ord1block = null; CollationElement ord2block = null; boolean advance_block_1 = true; boolean advance_block_2 = true; cs = getCollationElementIterator(source); ct = getCollationElementIterator(target);
compare(String s1, String s2){ CollationElementIterator cei1 = getCollationElementIterator(s1); CollationElementIterator cei2 = getCollationElementIterator(s2); for(;;) { int ord1 = cei1.next(); int ord2 = cei2.next(); // Check for end of string if (ord1 == CollationElementIterator.NULLORDER) if (ord2 == CollationElementIterator.NULLORDER) return(0); else return(-1); else if (ord2 == CollationElementIterator.NULLORDER) return(1); // We know chars are totally equal, so skip if (ord1 == ord2) continue; // Check for primary strength differences int prim1 = CollationElementIterator.primaryOrder(ord1); int prim2 = CollationElementIterator.primaryOrder(ord2); if (prim1 < prim2) return(-1); else if (prim1 > prim2) return(1); else if (getStrength() == PRIMARY) continue; // Check for secondary strength differences int sec1 = CollationElementIterator.secondaryOrder(ord1); int sec2 = CollationElementIterator.secondaryOrder(ord2); if (sec1 < sec2) return(-1); else if (sec1 > sec2) return(1); else if (getStrength() == SECONDARY) continue; // Check for tertiary differences int tert1 = CollationElementIterator.tertiaryOrder(ord1); int tert2 = CollationElementIterator.tertiaryOrder(ord1); if (tert1 < tert2) return(-1); else if (tert1 > tert2) return(1); }}